Skip to content

Commit 0224bb2

Browse files
authored
Reduced size of docker image (#117)
* Reduced size of docker image * Updated python image * Changed python image to alpine
1 parent f425dad commit 0224bb2

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

Dockerfile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
FROM python:3.11
1+
FROM python:3.11-alpine AS builder
22

33
ENV PYTHONUNBUFFERED 1
44

55
WORKDIR /app
66

7-
COPY ./requirements.txt /app/requirements.txt
7+
RUN apk add --no-cache gcc musl-dev python3-dev libffi-dev
88

9-
RUN pip install -r requirements.txt
9+
COPY ./requirements.txt /app/requirements.txt
10+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
1011

1112
COPY . /app
1213

13-
COPY ./entrypoint.sh /app/entrypoint.sh
14-
1514
RUN chmod +x /app/entrypoint.sh
1615

16+
17+
FROM python:3.11-alpine
18+
19+
ENV PYTHONUNBUFFERED 1
20+
21+
WORKDIR /app
22+
23+
RUN apk add --no-cache libffi
24+
25+
COPY --from=builder /install /usr/local
26+
COPY --from=builder /app /app
27+
1728
# Set the entrypoint to the entrypoint.sh script
18-
ENTRYPOINT ["/app/entrypoint.sh"]
29+
ENTRYPOINT ["/app/entrypoint.sh"]

0 commit comments

Comments
 (0)