-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (35 loc) · 1.27 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ARG ARCH
# doup:alpine
# python:3.11.2-alpine3.17
FROM ${ARCH}python:3.11.2-alpine as base
LABEL org.opencontainers.image.authors="Marty Winkler"
# Setup env
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1
ENV PYTHONUNBUFFERED=1
# --------------------------------------------------
FROM base AS python-deps
# Install pipenv
RUN pip install pipenv==2023.2.18
# Install python dependencies in /.venv
COPY Pipfile .
COPY Pipfile.lock .
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
# --------------------------------------------------
FROM base AS runtime
# Copy virtual env from python-deps stage
COPY --from=python-deps /.venv /.venv
ENV PATH="/.venv/bin:$PATH"
# Create and switch to a new user
RUN addgroup -S apprise-it-for-me && adduser -S apprise-it-for-me -G apprise-it-for-me
WORKDIR /apprise-it-for-me
USER apprise-it-for-me
HEALTHCHECK --interval=60s --timeout=3s --retries=6 CMD wget --no-verbose --tries=1 --spider http://localhost:${GUNICORN_PORT}/health || exit 1
ENV GUNICORN_PORT=8001
ENV WSGI_APP=manage:app
EXPOSE ${GUNICORN_PORT}/tcp
# Install application into container
COPY . /apprise-it-for-me
CMD ["sh", "-c", "gunicorn -c application/gunicorn.conf.py -b :${GUNICORN_PORT} --worker-tmp-dir /dev/shm \"${WSGI_APP}\""]