Refactor Dockerfile to not run as root
https://flask.palletsprojects.com/en/stable/deploying/gunicorn/#binding-externally
This commit is contained in:
+14
-3
@@ -1,5 +1,12 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM python:3.13.7-alpine
|
||||
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
|
||||
RUN addgroup -g $GID thirteener
|
||||
RUN adduser -D -g '' -u $UID -G thirteener thirteener
|
||||
|
||||
# Generic labels
|
||||
LABEL maintainer="Arian Mollik Wasi <arianmollik323@gmail.com>"
|
||||
LABEL version="0.3.4"
|
||||
@@ -18,9 +25,13 @@ LABEL org.opencontainers.image.description="My own custom 12ft.io replacement"
|
||||
LABEL org.opencontainers.image.documentation="https://github.com/wasi-master/13ft/blob/main/README.md"
|
||||
LABEL org.opencontainers.image.licenses=MIT
|
||||
|
||||
RUN python -m pip install --upgrade pip
|
||||
|
||||
USER thirteener
|
||||
COPY . .
|
||||
RUN pip install -r requirements.txt
|
||||
RUN --mount=type=cache,mode=0755,target=/home/thirteener/.cache/pip \
|
||||
pip install -U -r requirements.txt
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT [ "gunicorn" ]
|
||||
CMD [ "portable:app" ]
|
||||
CMD [ "python", "-m", "gunicorn", "portable:app" ]
|
||||
|
||||
Reference in New Issue
Block a user