Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile update #1350

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.20.2
FROM python:3.12-alpine

LABEL net.juniper.description="Junos PyEZ library for Python in a lightweight container." \
net.juniper.maintainer="[email protected]"
Expand All @@ -12,15 +12,12 @@ ADD requirements.txt .
ADD lib lib
ADD entrypoint.sh /usr/local/bin/.

## Install dependencies
## Install dependancies and PyEZ
RUN apk add --no-cache build-base python3-dev \
libxslt-dev libxml2-dev libffi-dev openssl-dev curl \
ca-certificates py3-pip bash

## Update as per PEP 668. Use Virtual Env
RUN python3 -m venv /scripts/.venv \
&& source /scripts/.venv/bin/activate \
&& pip install --upgrade pip \
RUN pip install --upgrade pip \
&& pip install pipdeptree \
&& python3 -m pip install -r requirements.txt \
&& pip install .
Expand Down
7 changes: 5 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ function pip_install {
}

function run_scripts {
echo "Executing defined script"
python3 $1 ${@:2}
if [ "$1" = "python3" ] || [ "$1" = "python" ]; then python3
else
echo "Executing defined script"
$1 ${@:2}
fi
}

## Manually defined variables will take precedence
Expand Down