Skip to content

Commit 6694742

Browse files
authored
Update Dockerfile
Add `--no-cache-dir` and do multistage build to reduce size of Docker image.
1 parent a285ad7 commit 6694742

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
FROM python:3.13-alpine
1+
FROM python:3.13-alpine AS base
22

33
WORKDIR /usr/src/app
44
RUN mkdir -p /data
55
COPY dist ./dist/
66
RUN pip install --no-cache-dir dist/openpectus_database_administration.tar.gz
7-
RUN pip install openpectus --no-deps
7+
RUN pip install openpectus --no-deps --no-cache-dir
8+
RUN rm -R ./dist
9+
10+
# Squash layers to reduce image size
11+
FROM scratch
12+
COPY --from=base / /
813

914
EXPOSE 8301
10-
CMD pectus-database-administration --host 0.0.0.0 --port 8301 --database /data/open_pectus_aggregator.sqlite3
15+
CMD pectus-database-administration --host 0.0.0.0 --port 8301 --database /data/open_pectus_aggregator.sqlite3

0 commit comments

Comments
 (0)