Forked from praveenweb/6.multi-stage-production-python.Dockerfile
Created
October 13, 2020 09:26
-
-
Save Keda87/16f45c7ed468d084922f38583a339229 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
# ---- Base python ---- | |
FROM python:3.6 AS base | |
# Create app directory | |
WORKDIR /app | |
# ---- Dependencies ---- | |
FROM base AS dependencies | |
COPY gunicorn_app/requirements.txt ./ | |
# install app dependencies | |
RUN pip install -r requirements.txt | |
# ---- Copy Files/Build ---- | |
FROM dependencies AS build | |
WORKDIR /app | |
COPY . /app | |
# Build / Compile if required | |
# --- Release with Alpine ---- | |
FROM python:3.6-alpine3.7 AS release | |
# Create app directory | |
WORKDIR /app | |
COPY --from=dependencies /app/requirements.txt ./ | |
COPY --from=dependencies /root/.cache /root/.cache | |
# Install app dependencies | |
RUN pip install -r requirements.txt | |
COPY --from=build /app/ ./ | |
CMD ["gunicorn", "--config", "./gunicorn_app/conf/gunicorn_config.py", "gunicorn_app:app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment