„Dockerfile“ ändern

Added non root run user
master
Marcus Weberskirch 2020-07-10 13:09:22 +00:00
parent a321f560d2
commit 5da9572eb8
1 changed files with 39 additions and 36 deletions

View File

@ -13,7 +13,9 @@ RUN apk add --no-cache nodejs npm && npm install && npm run build && apk del nod
# Build and deploy server instance # Build and deploy server instance
FROM python:3.7-slim AS base FROM python:3.7-slim AS base
#RUN apk add --no-cache --virtual ARG APP_USER=appuser
RUN groupadd -r ${APP_USER} && useradd --no-log-init -r -g ${APP_USER} ${APP_USER}
COPY --from=build_image /root/akte /opt/akte COPY --from=build_image /root/akte /opt/akte
COPY --from=build_image /root/client/dist /opt/akte/static/ COPY --from=build_image /root/client/dist /opt/akte/static/
WORKDIR /opt/akte WORKDIR /opt/akte
@ -32,6 +34,7 @@ COPY /django_settings_prod.py /opt/akte/akte/settings.py
# Dev-ready container - actual files will be mounted in # Dev-ready container - actual files will be mounted in
FROM base FROM base
USER ${APP_USER}:${APP_USER}
VOLUME /mnt VOLUME /mnt
CMD ["python" ,"/opt/akte/manage.py","runserver","0.0.0.0:8000"] CMD ["python" ,"/opt/akte/manage.py","runserver","0.0.0.0:8000"]
EXPOSE 8000 EXPOSE 8000