Skip to content

Commit fcd3565

Browse files
authored
Merge pull request #3 from NicoMartinic/2_update_dockerfiles
2 Update Python version. Add normal user instead of root inside backe…
2 parents 65df30c + b3f70e8 commit fcd3565

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

backend/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12
1+
FROM python:3.14
22
ENV PYTHONUNBUFFERED=1
33

44
WORKDIR /code
@@ -12,6 +12,9 @@ COPY requirements.txt /code/requirements.txt
1212

1313
RUN pip install --no-cache-dir -r requirements.txt
1414

15+
RUN groupadd --system appgroup && useradd --system --gid appgroup appuser \
16+
&& chown -R appuser:appgroup /code
17+
1518
COPY entrypoint.sh /
1619
RUN chmod +x /entrypoint.sh
1720

frontend/Dockerfile.production

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ WORKDIR /app
55
ARG BACKEND_URL
66
ENV BACKEND_URL=${BACKEND_URL}
77

8-
COPY package.json ./
9-
RUN npm install
8+
COPY package.json package-lock.json ./
9+
RUN npm ci
1010

1111
COPY . .
1212
RUN npm run build
@@ -26,5 +26,9 @@ COPY --from=build /app/.next/standalone ./
2626
COPY --from=build /app/.next/static ./.next/static
2727
COPY --from=build /app/public ./public
2828

29+
RUN addgroup -S appgroup && adduser -S appuser -G appgroup \
30+
&& chown -R appuser:appgroup /app
31+
32+
USER appuser
2933
EXPOSE ${PORT}
3034
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)