-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dockerfile updated with multistage build
Signed-off-by: Rajdeep Roy Chowdhury <[email protected]>
- Loading branch information
Showing
1 changed file
with
14 additions
and
6 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 |
---|---|---|
@@ -1,18 +1,26 @@ | ||
FROM alpine:3.20.0 | ||
FROM alpine:3.20.0 as builder | ||
|
||
RUN addgroup -S cfpredictorgroup && adduser -S cfpredictor -G cfpredictorgroup | ||
|
||
WORKDIR /home/cfpredictor | ||
|
||
COPY run.py requirements.txt /home/cfpredictor/ | ||
COPY app ./app | ||
|
||
RUN apk add --update --no-cache python3 clang && \ | ||
RUN apk add --update --no-cache python3 clang python3-devel && \ | ||
python3 -m venv .venv && \ | ||
/home/cfpredictor/.venv/bin/python3 -m ensurepip --upgrade && \ | ||
/home/cfpredictor/.venv/bin/pip3 --no-cache install --upgrade pip setuptools && \ | ||
/home/cfpredictor/.venv/bin/pip3 --no-cache install -r requirements.txt | ||
|
||
FROM alpine:3.20.0 | ||
|
||
RUN addgroup -S cfpredictorgroup && adduser -S cfpredictor -G cfpredictorgroup && \ | ||
apk add --update --no-cache python3 | ||
|
||
WORKDIR /home/cfpredictor | ||
|
||
COPY --from=builder /home/cfpredictor/.venv/ /home/cfpredictor/.venv/ | ||
COPY run.py requirements.txt /home/cfpredictor/ | ||
COPY app ./app | ||
|
||
USER cfpredictor | ||
|
||
CMD ["python3", "run.py"] | ||
CMD [".venv/bin/python3", "run.py"] |