diff --git a/Dockerfile.prod b/Dockerfile.prod new file mode 100644 index 0000000..5ec8e63 --- /dev/null +++ b/Dockerfile.prod @@ -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