1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 13:16:44 +02:00

Merge pull request #1 from bglopez/docker

Added Dockerfile and docker-compose.yml
This commit is contained in:
Brandon Lopez
2018-08-01 19:23:32 -07:00
committed by GitHub
11 changed files with 69 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
.travis.yml
.git
.gitignore
docker-compose.yml
Dockerfile
+1
View File
@@ -4,3 +4,4 @@ ve/
share/vim/.vim/
share/vim/.viminfo
typescript
venv/
+24
View File
@@ -0,0 +1,24 @@
dist: trusty
sudo: required
language:
- generic
services:
- docker
env:
DOCKER_COMPOSE_VERSION: 1.22.0
addons:
apt:
packages:
- docker-ce
before_install:
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- docker-compose up -d
- docker ps
+13
View File
@@ -0,0 +1,13 @@
FROM alpine:latest
WORKDIR /app
COPY . /app
RUN apk add --update --no-cache python2 py2-pip py2-gevent \
py2-flask py2-requests py2-pygments py2-redis \
py2-cffi py2-icu bash vim gawk sed \
&& apk add --no-cache --virtual build-deps python2-dev \
build-base git \
&& pip install -r requirements.txt \
&& sh share/scripts/get-sheets.sh \
&& apk del build-deps
ENTRYPOINT ["python2"]
CMD ["bin/srv.py"]
+2 -1
View File
@@ -6,8 +6,9 @@ Main server program.
"""
from __future__ import print_function
from gevent.pywsgi import WSGIServer
from gevent.monkey import patch_all
from gevent.pywsgi import WSGIServer
patch_all()
# pylint: disable=wrong-import-position,wrong-import-order
+15
View File
@@ -0,0 +1,15 @@
version: '2'
services:
app:
build:
context: .
depends_on:
- redis
ports:
- "8002:8002"
redis:
image: redis:4-alpine
volumes:
- redis_data:/data
volumes:
redis_data:
+2 -2
View File
@@ -36,10 +36,10 @@ import redis
MYDIR = os.path.abspath(os.path.join(__file__, '..', '..'))
sys.path.append("%s/lib/" % MYDIR)
from languages_data import VIM_NAME
from globals import PATH_VIM_ENVIRONMENT
from globals import PATH_VIM_ENVIRONMENT, REDISHOST
# pylint: enable=wrong-import-position,wrong-import-order
REDIS = redis.StrictRedis(host='localhost', port=6379, db=1)
REDIS = redis.StrictRedis(host=REDISHOST, port=6379, db=1)
FNULL = open(os.devnull, 'w')
TEXT = 0
CODE = 1
+2 -2
View File
@@ -25,13 +25,13 @@ from polyglot.detect.base import UnknownLanguage
import time
import beautifier
from globals import MYDIR, PATH_TLDR_PAGES, PATH_CHEAT_PAGES, PATH_CHEAT_SHEETS, COLOR_STYLES
from globals import MYDIR, PATH_TLDR_PAGES, PATH_CHEAT_PAGES, PATH_CHEAT_SHEETS, COLOR_STYLES, REDISHOST
from adapter_learnxiny import get_learnxiny, get_learnxiny_list, is_valid_learnxy
from languages_data import LANGUAGE_ALIAS, SO_NAME
from colorize_internal import colorize_internal
# pylint: enable=wrong-import-position,wrong-import-order
REDIS = redis.StrictRedis(host='localhost', port=6379, db=0)
REDIS = redis.StrictRedis(host=REDISHOST, port=6379, db=0)
MAX_SEARCH_LEN = 20
+2 -1
View File
@@ -9,6 +9,7 @@ import os
from pygments.styles import get_all_styles
MYDIR = os.path.abspath(os.path.join(__file__, '..', '..'))
REDISHOST = 'redis'
ANSI2HTML = os.path.join(MYDIR, "share/ansi2html.sh")
@@ -18,7 +19,7 @@ TEMPLATES = os.path.join(MYDIR, 'share/templates')
STATIC = os.path.join(MYDIR, 'share/static')
PATH_VIM_ENVIRONMENT = os.path.join(MYDIR, 'share/vim')
USE_OS_PACKAGES = True # change it False if you pull cheat sheets repositories from GitHub
USE_OS_PACKAGES = False # change it False if you pull cheat sheets repositories from GitHub
if USE_OS_PACKAGES:
PATH_TLDR_PAGES = "/home/igor/.tldr/cache/pages/*/*.md"
PATH_CHEAT_PAGES = "/usr/local/lib/python2.7/dist-packages/cheat/cheatsheets/*"
+2 -1
View File
@@ -3,8 +3,9 @@ Support for the stateful queries
"""
import redis
from globals import REDISHOST
REDIS = redis.StrictRedis(host='localhost', port=6379, db=1)
REDIS = redis.StrictRedis(host=REDISHOST, port=6379, db=1)
def save_query(client_id, query):
"""
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
## this doesn't error check, if it breaks and destroys things I'm sorry