Skip to content

Commit

Permalink
added production dockerfile, started multi-stage build #5
Browse files Browse the repository at this point in the history
  • Loading branch information
asuresh-code committed Nov 22, 2024
1 parent 005e416 commit 4bba5fe
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3.12.7-alpine3.20@sha256:edd1d8559c585e1e9a9b79de44ac27f8ac32cb0c7323e112ae6870ceeecd8dbf


COPY requirements.txt ./

RUN set -eux; \
\
# Install pip dependencies \
python3 -m pip install --no-cache-dir -r requirements.txt;

FROM python:3.12.7-alpine3.20@sha256:edd1d8559c585e1e9a9b79de44ac27f8ac32cb0c7323e112ae6870ceeecd8dbf

WORKDIR /object-storage-api-run


COPY README.md ./
COPY object_storage_api/ object_storage_api/

RUN set -eux; \
\
# Create loging.ini from its .example file \
cp object_storage_api/logging.example.ini object_storage_api/logging.ini; \
\
# Create a non-root user to run as \
addgroup -S object-storage-api; \
adduser -S -D -G object-storage-api -H -h /object-storage-api-run object-storage-api;

USER object-storage-api

CMD ["uvicorn", "object_storage_api.main:app", "--app-dir", "/object-storage-api-run", "--host", "0.0.0.0", "--port", "8000"]
EXPOSE 8000

0 comments on commit 4bba5fe

Please sign in to comment.