2021-07-10 12:23:33 +00:00
|
|
|
FROM python:3.8-alpine as build
|
2021-07-09 21:27:41 +00:00
|
|
|
|
|
|
|
RUN apk add gettext git gcc python3-dev musl-dev \
|
|
|
|
libffi-dev zlib-dev jpeg-dev libjpeg postgresql-dev build-base \
|
|
|
|
--virtual .build-dependencies
|
|
|
|
|
2021-07-10 12:23:33 +00:00
|
|
|
RUN mkdir -p /app/{code,venv}
|
|
|
|
WORKDIR /app/code
|
|
|
|
COPY Pipfile Pipfile.lock /app/code/
|
2021-07-09 21:27:41 +00:00
|
|
|
|
2021-07-10 12:23:33 +00:00
|
|
|
RUN python3 -m venv /app/venv
|
|
|
|
RUN pip install pipenv setuptools
|
|
|
|
ENV PATH="/app/venv/bin:$PATH" VIRTUAL_ENV="/app/venv"
|
|
|
|
RUN pip install wheel cppy
|
|
|
|
# Install dependencies into the virtual environment with Pipenv
|
|
|
|
RUN pipenv install --deploy --verbose
|
2021-07-09 21:27:41 +00:00
|
|
|
|
2021-07-10 12:23:33 +00:00
|
|
|
FROM python:3.8-alpine
|
2021-07-09 21:27:41 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache libpq libstdc++ libjpeg
|
|
|
|
|
2021-07-10 12:23:33 +00:00
|
|
|
COPY . /app/code/
|
|
|
|
WORKDIR /app/code
|
|
|
|
|
|
|
|
COPY --from=build /app/venv /app/venv
|
|
|
|
ENV PATH="/app/venv/bin:$PATH" VIRTUAL_ENV="/app/venv"
|
2021-07-09 21:27:41 +00:00
|
|
|
|
|
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "-k", "gevent", "--worker-connections", "1000", "app:app"]
|
|
|
|
|
2021-07-10 12:23:33 +00:00
|
|
|
VOLUME /app/code
|
2021-07-09 21:27:41 +00:00
|
|
|
|
|
|
|
EXPOSE 5000
|