Created
July 27, 2018 15:47
-
-
Save thnee/4be9be5698e9008f837af062873dac13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Os layer | |
FROM python:3.7-alpine AS os | |
# minimal | |
FROM scratch AS minimal | |
COPY --from=os /usr/local /usr/local | |
COPY --from=os /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1 | |
COPY --from=os /lib/libz.so.1 /lib/libz.so.1 | |
COPY --from=os /usr/lib/libsqlite3.so.0 /usr/lib/libsqlite3.so.0 | |
# Server layer | |
FROM python:3.7-alpine | |
RUN apk add gcc musl-dev linux-headers | |
RUN pip install --target=/opt uwsgi | |
# Application layer | |
FROM python:3.7-alpine | |
ENV PYTHONPATH=/opt | |
RUN pip install --target=/opt Django | |
RUN /opt/bin/django-admin startproject application /opt | |
# Replace the python image here with scratch for a minmal distro (requires copying of python binary & libs) | |
FROM minimal | |
# Copy Server stuff (uwsgi) | |
COPY --from=1 /opt /opt | |
# Copy application | |
COPY --from=2 /opt /opt | |
ENV PYTHONPATH=/opt | |
CMD ["/opt/bin/uwsgi", "--http", ":9090", "--wsgi", "application.wsgi"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment