-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1942 from duhow/dockerfile
Optimize Dockerfile
- Loading branch information
Showing
1 changed file
with
13 additions
and
7 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,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"] |