forked from Botanical/BotanJS
Use Alpine linux for smaller image
This commit is contained in:
parent
0640442953
commit
2608ff4ed1
13
Dockerfile
13
Dockerfile
@ -1,21 +1,18 @@
|
|||||||
FROM python:latest
|
FROM alpine:latest
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y openjdk-11-jre
|
|
||||||
|
|
||||||
RUN mkdir -p /opt/utils
|
RUN mkdir -p /opt/utils
|
||||||
RUN wget -O /opt/utils/closure.jar "https://repo1.maven.org/maven2/com/google/javascript/closure-compiler/v20200830/closure-compiler-v20200830.jar"
|
RUN wget -O /opt/utils/closure.jar "https://repo1.maven.org/maven2/com/google/javascript/closure-compiler/v20200830/closure-compiler-v20200830.jar"
|
||||||
RUN wget -O /opt/utils/yuicompressor.jar "https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar"
|
RUN wget -O /opt/utils/yuicompressor.jar "https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar"
|
||||||
|
|
||||||
RUN pip install virtualenv
|
RUN apk add --update bash python3 uwsgi uwsgi-python; python3 -m ensurepip
|
||||||
|
|
||||||
|
RUN echo "www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin" >> /etc/passwd; echo "www-data:x:33:" >> /etc/group
|
||||||
RUN chown www-data:www-data . -R
|
RUN chown www-data:www-data . -R
|
||||||
|
|
||||||
|
RUN pip3 install Flask redis compressinja Celery
|
||||||
USER www-data
|
USER www-data
|
||||||
|
|
||||||
RUN virtualenv env
|
|
||||||
RUN env/bin/pip install Flask redis compressinja Celery uwsgi
|
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
ENTRYPOINT ["setup/docker.start"]
|
ENTRYPOINT ["setup/docker.start"]
|
||||||
|
|
||||||
|
4
k8s.yaml
4
k8s.yaml
@ -19,7 +19,7 @@ spec:
|
|||||||
path: /srv/astrostorage
|
path: /srv/astrostorage
|
||||||
containers:
|
containers:
|
||||||
- name: web
|
- name: web
|
||||||
image: 192.168.80.4:32000/sites/astrojs:b00019
|
image: 192.168.80.4:32000/sites/astrojs:b00027
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: "/app/cache"
|
- mountPath: "/app/cache"
|
||||||
name: astrojs-cache
|
name: astrojs-cache
|
||||||
@ -33,7 +33,7 @@ spec:
|
|||||||
- name: redis
|
- name: redis
|
||||||
image: redis:6.0.8-alpine
|
image: redis:6.0.8-alpine
|
||||||
- name: compiler
|
- name: compiler
|
||||||
image: 192.168.80.4:32000/sites/astrojs:b00018
|
image: 192.168.80.4:32000/sites/astrojs:b00027
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: "/app/cache"
|
- mountPath: "/app/cache"
|
||||||
name: astrojs-cache
|
name: astrojs-cache
|
||||||
|
@ -9,7 +9,8 @@ mkdir -p cache/botanjs
|
|||||||
case "$RUN_MODE" in
|
case "$RUN_MODE" in
|
||||||
"web")
|
"web")
|
||||||
./botan-rebuild.py
|
./botan-rebuild.py
|
||||||
./env/bin/uwsgi \
|
uwsgi \
|
||||||
|
--plugins-dir /usr/lib/uwsgi/ --need-plugin python \
|
||||||
--http-socket :5000 \
|
--http-socket :5000 \
|
||||||
--wsgi-file main.py \
|
--wsgi-file main.py \
|
||||||
--callable application --master \
|
--callable application --master \
|
||||||
@ -18,10 +19,10 @@ case "$RUN_MODE" in
|
|||||||
"tasks")
|
"tasks")
|
||||||
source "$INST_DIR/celery.conf"
|
source "$INST_DIR/celery.conf"
|
||||||
|
|
||||||
"$BIN_ROOT/celery" worker -n worker1@%h \
|
celery worker -n worker1@%h \
|
||||||
-A ${CELERY_APP} \
|
-A ${CELERY_APP} \
|
||||||
--loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} \
|
--loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} \
|
||||||
& "$BIN_ROOT/celery" worker -n worker1@%h \
|
& celery worker -n worker1@%h \
|
||||||
-A ${CELERY_APP} \
|
-A ${CELERY_APP} \
|
||||||
--loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
|
--loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user