Skip to content

Commit e915b7b

Browse files
committed
docker: don't use root user, only copy package source
Signed-off-by: Bradley Reynolds <[email protected]>
1 parent 55630e8 commit e915b7b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
FROM --platform=linux/amd64 python:3.11-slim@sha256:66e41d125c90d679ad69b264ac7b78a3bd27e7510b63ba5987ad42678bbefc32
22

3+
RUN adduser --disabled-password api
4+
USER api
5+
6+
ENV PATH="${PATH}:/home/api/.local/bin"
7+
38
# Set Git SHA environment variable
49
ARG git_sha="development"
510
ENV GIT_SHA=$git_sha
611

7-
COPY . .
12+
WORKDIR /app
13+
COPY pyproject.toml src ./
14+
RUN python -m pip install .
815

9-
RUN pip install .
16+
EXPOSE 8080
1017

1118
CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "8080"]

0 commit comments

Comments
 (0)