Browse Source

add docker

main
squeaky otter 5 months ago
parent
commit
6942041f1f
Signed by: dashie GPG Key ID: C2D57B325840B755
  1. 38
      Dockerfile
  2. 7
      docker/entrypoint.sh
  3. 5
      docker/server.sh

38
Dockerfile

@ -0,0 +1,38 @@
FROM alpine:3.10
ADD ./ /app/
RUN \
echo 'installing dependencies' && \
apk add --no-cache \
bash \
git \
musl-dev \
gcc \
postgresql-dev \
python3-dev \
py3-psycopg2 \
make \
zlib-dev \
jpeg-dev \
libmagic \
&& \
ln -s /usr/bin/python3 /usr/bin/python
# hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072
ENV PIP_DOWNLOAD_CACHE=/noop/
RUN \
echo 'installing pip requirements' && \
pip3 install --upgrade pip && \
pip3 install setuptools wheel && \
pip3 install -r /app/requirements.txt && \
rm -rf $PIP_DOWNLOAD_CACHE
RUN mkdir /uploads /statics
VOLUME /uploads
VOLUME /statics
EXPOSE 8000
WORKDIR /app/
ENTRYPOINT ["./docker/entrypoint.sh"]
CMD ["./docker/server.sh"]

7
docker/entrypoint.sh

@ -0,0 +1,7 @@
#!/bin/sh
set -e
export STATIC_ROOT=/statics
export MEDIA_ROOT=/uploads
exec "$@"

5
docker/server.sh

@ -0,0 +1,5 @@
#!/bin/bash -eux
python /app/manage.py collectstatic --noinput
python /app/manage.py migrate
cd /app/
gunicorn --log-file=- --worker-tmp-dir /dev/shm config.asgi:application -w ${CAMGEAR_WEB_WORKERS-2} --threads ${CAMGEAR_WEB_THREADS-4} -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 ${GUNICORN_ARGS-}
Loading…
Cancel
Save