You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
888 B
36 lines
888 B
FROM python:3.8-alpine |
|
|
|
# install required packages |
|
RUN apk add --no-cache gcc |
|
RUN apk add --no-cache python3-dev |
|
RUN apk add --no-cache libc-dev |
|
RUN apk add --no-cache libffi-dev |
|
RUN apk add --no-cache openssl |
|
RUN apk add --no-cache openssl-dev |
|
|
|
# add user that will be used to install and run the application |
|
RUN adduser -D deploy |
|
|
|
# switch to the created user and install the application |
|
USER deploy |
|
ENV PATH "$PATH:/home/deploy/.local/bin" |
|
|
|
COPY . /app |
|
WORKDIR /app |
|
|
|
RUN pip install --upgrade pip |
|
RUN pip install gunicorn |
|
RUN pip install wheel |
|
|
|
RUN pip install -r requirements.txt |
|
RUN flit install --pth-file |
|
|
|
# switch back to root to remove header files |
|
USER root |
|
RUN apk delete python3-dev |
|
RUN apk delete libffi-dev |
|
RUN apk delete openssl-dev |
|
|
|
# switch to the created user to run the application |
|
USER deploy |
|
CMD ["gunicorn", "--paster", "/app/production.ini", "-b", "0.0.0.0:8000"]
|
|
|