Skip to content

Commit

Permalink
Merge pull request #1135 from uselagoon/add_python_313
Browse files Browse the repository at this point in the history
build: add python-13 image
  • Loading branch information
tobybellwood authored Oct 16, 2024
2 parents 58cf5d8 + 0987957 commit eb3ecdc
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ versioned-images := php-8.1-fpm \
python-3.10 \
python-3.11 \
python-3.12 \
python-3.13 \
node-18 \
node-18-builder \
node-18-cli \
Expand Down Expand Up @@ -292,7 +293,7 @@ build/php-8.3-cli: build/php-8.3-fpm
build/php-8.1-cli-drupal: build/php-8.1-cli
build/php-8.2-cli-drupal: build/php-8.2-cli
build/php-8.3-cli-drupal: build/php-8.3-cli
build/python-3.7 build/python-3.8 build/python-3.9 build/python-3.10 build/python-3.11 build/python-3.12: build/commons
build/python-3.7 build/python-3.8 build/python-3.9 build/python-3.10 build/python-3.11 build/python-3.12 build/python-3.13: build/commons
build/node-18 build/node-20 build/node-22: build/commons
build/node-18-builder build/node-18-cli: build/node-18
build/node-20-builder build/node-20-cli: build/node-20
Expand Down
11 changes: 11 additions & 0 deletions helpers/TESTING_base_images_dockercompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-10
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-11
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-12
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep python-3-13
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-1
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-2
docker ps --filter label=com.docker.compose.project=all-images | grep Up | grep ruby-3-3
Expand Down Expand Up @@ -236,6 +237,16 @@ docker compose exec -T python-3-12 sh -c "pip list --no-cache-dir" | grep "virtu
# python-3-12 should be serving content
docker compose exec -T commons sh -c "curl python-3-12:3000/tmp/test" | grep "Python 3.12"

# python-3-13 should be version 3.13
docker compose exec -T python-3-13 sh -c "python -V" | grep "3.13"

# python-3-13 should have basic tools installed
docker compose exec -T python-3-13 sh -c "pip list --no-cache-dir" | grep "pip"
docker compose exec -T python-3-13 sh -c "pip list --no-cache-dir" | grep "virtualenv"

# python-3-13 should be serving content
docker compose exec -T commons sh -c "curl python-3-13:3000/tmp/test" | grep "Python 3.13"

# node-18 should have Node 18
docker compose exec -T node-18 sh -c "node -v" | grep "v18"

Expand Down
10 changes: 10 additions & 0 deletions helpers/images-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ services:
exec python -m http.server 3000
"]
python-3-13:
image: uselagoon/python-3.13:latest
ports:
- "3000"
<< : *default-user # uses the defined user from top
command: ["sh", "-c", "
python -V | xargs > tmp/test;
exec python -m http.server 3000
"]
ruby-3-1:
image: uselagoon/ruby-3.1:latest
ports:
Expand Down
52 changes: 52 additions & 0 deletions images/python/3.13.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons AS commons

FROM python:3.13.0-alpine3.20

ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
LABEL org.opencontainers.image.authors="The Lagoon Authors"
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images/blob/main/images/python/3.13.Dockerfile"
LABEL org.opencontainers.image.url="https://github.com/uselagoon/lagoon-images"
LABEL org.opencontainers.image.version="${LAGOON_VERSION}"
LABEL org.opencontainers.image.description="Python 3.13 image optimised for running in Lagoon in production and locally"
LABEL org.opencontainers.image.title="uselagoon/python-3.13"
LABEL org.opencontainers.image.base.name="docker.io/python:3.13-alpine3.20"

ENV LAGOON=python

# Copy commons files
COPY --from=commons /lagoon /lagoon
COPY --from=commons /bin/fix-permissions /bin/ep /bin/docker-sleep /bin/wait-for /bin/
COPY --from=commons /sbin/tini /sbin/
COPY --from=commons /home /home

RUN fix-permissions /etc/passwd \
&& mkdir -p /home

ENV TMPDIR=/tmp \
TMP=/tmp \
HOME=/home \
# When Bash is invoked via `sh` it behaves like the old Bourne Shell and sources a file that is given in `ENV`
ENV=/home/.bashrc \
# When Bash is invoked as non-interactive (like `bash -c command`) it sources a file that is given in `BASH_ENV`
BASH_ENV=/home/.bashrc

RUN apk update \
&& apk add --no-cache --virtual .build-deps \
build-base \
&& pip install --upgrade pip \
&& pip install virtualenv \
&& apk del \
.build-deps \
&& apk add --no-cache \
rsync \
tar \
&& rm -rf /var/cache/apk/*

# Make sure shells are not running forever
COPY 80-shell-timeout.sh /lagoon/entrypoints/
RUN echo "source /lagoon/entrypoints/80-shell-timeout.sh" >> /home/.bashrc

ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"]
CMD ["python"]

0 comments on commit eb3ecdc

Please sign in to comment.