-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added production dockerfile, started multi-stage build #5
- Loading branch information
1 parent
005e416
commit 4bba5fe
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |