From ca066e5e34f171475610f275fcfbf8636da2f393 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Thu, 12 Dec 2024 00:04:07 +1100 Subject: [PATCH] Update docker and startServer script --- Dockerfile | 12 ++++++------ startServer.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4792817..0db339f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,8 @@ -# Use the official Python base image FROM python:3.10-slim -# Set the working directory in the container WORKDIR /app +RUN useradd -l -m -s /bin/bash appuser -# Copy the pyproject.toml and poetry.lock files into the container COPY pyproject.toml poetry.lock ./ # For Docker build to understand the possible env @@ -16,8 +14,10 @@ RUN apt update && \ poetry lock && \ poetry install -# Expose the port the app runs on -EXPOSE 8000 -# Copy the rest of the application code into the container COPY . /app + +RUN chown -R appuser:appuser /app +USER appuser + +EXPOSE 8000 diff --git a/startServer.sh b/startServer.sh index 3356ba8..cc0188d 100755 --- a/startServer.sh +++ b/startServer.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker compose build && docker compose up +docker compose down && docker compose build && docker compose up