Skip to content

Commit

Permalink
Merge pull request #1942 from duhow/dockerfile
Browse files Browse the repository at this point in the history
Optimize Dockerfile
  • Loading branch information
mirceaulinic authored Apr 4, 2024
2 parents d609f6b + af5c7d0 commit aaff777
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
FROM python:3.6-slim-stretch
# syntax=docker/dockerfile:1.4

FROM scratch AS installer
COPY ./ /var/cache/napalm/

RUN apt-get update \
&& apt-get install -y python-dev python-cffi libxslt1-dev libssl-dev libffi-dev \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& pip --no-cache-dir install -U cffi cryptography /var/cache/napalm/ \
&& rm -rf /var/cache/napalm/
FROM python:3.12-slim-bookworm

RUN --mount=type=bind,from=installer,source=/var/cache/napalm,target=/var/cache/napalm,rw \
apt-get update && \
apt-get install -y \
python3-dev libxslt1-dev libssl-dev libffi-dev && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* && \
pip --no-cache-dir install -U cffi cryptography /var/cache/napalm/

ENTRYPOINT ["napalm"]

0 comments on commit aaff777

Please sign in to comment.