Skip to content

Commit f30c419

Browse files
committed
fix: build non-root image
1 parent 3eacf4d commit f30c419

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.hadolint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignored:
2+
- DL3018

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ ENV PYTHONFAULTHANDLER=1 \
99
APP_PATH="/app"
1010
# prepend venv to path
1111
ENV PATH="$VENV_PATH/bin:$PATH"
12+
1213
WORKDIR $APP_PATH
1314

15+
RUN adduser -Ds /bin/bash sentry
16+
1417

1518
# Build
1619
FROM python-base as builder-base
@@ -23,7 +26,7 @@ ENV PIP_DEFAULT_TIMEOUT=100 \
2326

2427
# get poetry
2528
RUN apk update \
26-
&& apk add --update --no-cache curl==7.88.1-r1 gcc=12.2.1_git20220924-r4 linux-headers=5.19.5-r0 build-base=0.5-r3 \
29+
&& apk add --update --no-cache curl gcc linux-headers build-base \
2730
&& curl -sSL https://install.python-poetry.org | python -
2831

2932
RUN python -m venv "$VENV_PATH"
@@ -47,7 +50,7 @@ FROM builder-base as static-base
4750
RUN python manage.py download_vendor_files && python manage.py collectstatic
4851

4952
# Static
50-
FROM nginx:mainline-alpine as static
53+
FROM nginxinc/nginx-unprivileged:mainline-alpine as static
5154
COPY --from=static-base /app/assets /usr/share/nginx/html
5255

5356
# Prod
@@ -58,4 +61,6 @@ COPY . $APP_PATH
5861

5962
RUN chmod u+rwx "$APP_PATH/manage.py"
6063

64+
USER sentry
65+
6166
CMD ["gunicorn", "controller.wsgi", "-c", "/app/config.py"]

0 commit comments

Comments
 (0)