-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (37 loc) · 1.5 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
###########
# BUILDER #
###########
# pull official base image
FROM python:3.9 as builder
# install python dependencies
WORKDIR /home/monitor
COPY requirements.txt .
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
#########
# FINAL #
#########
FROM python:3.9-slim
# create the appropriate directories
ENV HOME=/var/www
ENV APP_HOME=/var/www/app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN groupadd -r monitor && useradd -m -r -g monitor monitor
COPY --from=builder /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
WORKDIR $APP_HOME
COPY monitor .
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && mkdir staticfiles && chown -R monitor:monitor .
USER monitor
EXPOSE 8000
LABEL org.opencontainers.image.title="n0nuser/Monitor" \
org.opencontainers.image.description="\
A web application monitoring web application built with Python and Django." \
org.opencontainers.image.url="https://n0nuser.es/" \
org.opencontainers.image.source="https://github.com/n0nuser/Monitor" \
org.opencontainers.image.authors="Pablo González Rubio (https://n0nuser.es)" \
org.opencontainers.image.licenses="GPL-3.0"
# CMD ["gunicorn", "monitor.asgi:application", "--bind", ":8000", "--workers", "4", "-k", "uvicorn.workers.UvicornWorker"]
ENTRYPOINT "/entrypoint.sh"