Skip to content

Instantly share code, notes, and snippets.

@kesnel
Created November 7, 2021 15:50
Show Gist options
  • Save kesnel/b4237fc13807f149d37dfc68bd2979eb to your computer and use it in GitHub Desktop.
Save kesnel/b4237fc13807f149d37dfc68bd2979eb to your computer and use it in GitHub Desktop.
FROM python:3.10-alpine
LABEL maintainer="website.com"
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /requirements.txt
COPY ./app /app
COPY ./scripts /scripts
COPY ./nginx /nginx
WORKDIR /app
EXPOSE 8000
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip setuptools && \
apk add --no-cache --update python3 && \
apk add python3-dev && \
apk add --no-cache jpeg-dev zlib-dev && \
pip install Pillow &&\
apk add --update postgresql-client && \
apk add --update --virtual .tmp-deps \
build-base postgresql-dev musl-dev linux-headers && \
/py/bin/pip install -r /requirements.txt && \
apk del .tmp-deps && \
adduser --disabled-password --no-create-home app && \
mkdir -p /vol/web/cdn/static/ && \
mkdir -p /vol/web/cdn/media/ && \
chown -R app:app /vol && \
chmod -R 755 /vol && \
chmod -R +x /scripts
ENV PATH="/scripts:/py/bin:$PATH"
USER app
CMD ["run.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment