Skip to content

Commit b4da9f4

Browse files
authored
Merge pull request plus3it#1436 from lorengordon/feat/uv
Uses uv to install python versions in docker image
2 parents 2d147f1 + f8c5e6d commit b4da9f4

7 files changed

Lines changed: 158 additions & 90 deletions

File tree

.github/dependabot.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ updates:
1717
open-pull-requests-limit: 10
1818
ignore:
1919
# See <https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#ignore>
20-
- dependency-name: python
20+
- dependency-name: debian
2121
update-types:
22-
# Ignore major/minor to pin python 3.13.x in ./Dockerfile until cfn-lint is compatible
22+
# Ignore major/minor to pin debian bookworm
2323
- "version-update:semver-major"
24-
- "version-update:semver-minor"
2524
- package-ecosystem: docker
2625
directory: "/.github/dependencies/python312"
2726
schedule:
@@ -34,6 +33,30 @@ updates:
3433
- "version-update:semver-major"
3534
- "version-update:semver-minor"
3635
open-pull-requests-limit: 10
36+
- package-ecosystem: docker
37+
directory: "/.github/dependencies/python313"
38+
schedule:
39+
interval: weekly
40+
ignore:
41+
# See <https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#ignore>
42+
- dependency-name: python
43+
update-types:
44+
# Ignore major/minor to pin python 3.13.x
45+
- "version-update:semver-major"
46+
- "version-update:semver-minor"
47+
open-pull-requests-limit: 10
48+
- package-ecosystem: docker
49+
directory: "/.github/dependencies/python314"
50+
schedule:
51+
interval: weekly
52+
ignore:
53+
# See <https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#ignore>
54+
- dependency-name: python
55+
update-types:
56+
# Ignore major/minor to pin python 3.14.x
57+
- "version-update:semver-major"
58+
- "version-update:semver-minor"
59+
open-pull-requests-limit: 10
3760
- package-ecosystem: github-actions
3861
directory: "/"
3962
schedule:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This Dockerfile is used to let Dependabot manage the pinned version of Python 3.13
2+
# that will be installed into the docker container.
3+
4+
# This file is separate from the other Dockerfile tools in order to create a separate
5+
# entry in the Dependabot config that ignores major and minor version updates, in
6+
# order to keep this pinned to Python 3.13.
7+
8+
FROM python:3.13.12 as python313
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This Dockerfile is used to let Dependabot manage the pinned version of Python 3.14
2+
# that will be installed into the docker container.
3+
4+
# This file is separate from the other Dockerfile tools in order to create a separate
5+
# entry in the Dependabot config that ignores major and minor version updates, in
6+
# order to keep this pinned to Python 3.14.
7+
8+
FROM python:3.14.3 as python314

.github/workflows/dependabot_hack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
# Keep these sorted alphabetically by <user>/<repo>, separated by an empty line
2424

25-
- uses: boxboat/fixuid@v0.6.0
25+
- uses: astral-sh/uv@0.10.10
2626

2727
- uses: gruntwork-io/terragrunt@5.14.1
2828

Dockerfile

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,58 @@
22

33
FROM golang:1.26-bookworm AS golang
44

5-
FROM python:3.13.12-bookworm
5+
FROM debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a
66

77
ARG PROJECT_NAME=tardigrade-ci
88

99
ENV USER=${PROJECT_NAME}
10-
ENV USER_UID=1000
11-
ENV USER_GID=${USER_UID}
1210

1311
# Things to do as root
1412
USER root
1513

1614
RUN apt-get update -y && apt-get install -y \
1715
xz-utils \
1816
curl \
17+
git \
1918
jq \
2019
unzip \
2120
make \
2221
vim \
23-
build-essential \
24-
libssl-dev \
25-
zlib1g-dev \
26-
libbz2-dev \
27-
libreadline-dev \
28-
libsqlite3-dev \
29-
llvm \
30-
libncursesw5-dev \
31-
tk-dev \
32-
libxml2-dev \
33-
libxmlsec1-dev \
34-
libffi-dev \
35-
liblzma-dev \
3622
&& touch /.dockerenv \
3723
&& rm -rf /var/lib/apt/lists/*
3824

39-
RUN addgroup --gid ${USER_GID} ${USER} \
40-
&& adduser --disabled-password --gecos '' --uid ${USER_UID} --gid ${USER_GID} ${USER}
25+
RUN addgroup --gid 1000 ${USER} \
26+
&& adduser --disabled-password --gecos '' --uid 1000 --gid 1000 ${USER}
4127

4228
COPY --from=golang /usr/local/go/ /usr/local/go/
4329
COPY --chown=${USER}:${USER} --from=golang /go/ /go/
4430
COPY --chown=${USER}:${USER} . /${PROJECT_NAME}
4531
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
4632

47-
RUN --mount=type=secret,id=GITHUB_ACCESS_TOKEN,env=GITHUB_ACCESS_TOKEN \
48-
make -C /${PROJECT_NAME} fixuid/install \
49-
&& cp /root/bin/fixuid /usr/local/bin/fixuid \
50-
&& chown root:root /usr/local/bin/fixuid \
51-
&& chmod 4755 /usr/local/bin/fixuid\
52-
&& mkdir -p /etc/fixuid \
53-
&& printf "user: $USER\ngroup: $USER\n" > /etc/fixuid/config.yml
54-
5533
# Things to do as $USER
5634
USER ${USER}
5735

36+
ENV PIP_NO_CACHE_DIR=1
37+
ENV UV_NO_CACHE=1
38+
5839
ENV HOME="/home/${USER}"
59-
ENV PYENV_ROOT=${HOME}/.pyenv
60-
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:${HOME}/.local/bin:${HOME}/bin:/go/bin:/usr/local/go/bin:${PATH}"
40+
ENV VIRTUAL_ENV=${HOME}/.venv
41+
ENV PATH="${VIRTUAL_ENV}/bin:${HOME}/.local/bin:${HOME}/bin:/go/bin:/usr/local/go/bin:${PATH}"
42+
6143
ENV GOPATH=/go
6244
ENV TF_PLUGIN_CACHE_DIR=${HOME}/.terraform.d/plugin-cache
6345

6446
RUN mkdir -p "$TF_PLUGIN_CACHE_DIR"
6547

66-
RUN --mount=type=secret,id=GITHUB_ACCESS_TOKEN,env=GITHUB_ACCESS_TOKEN \
67-
make -C /${PROJECT_NAME} install
48+
RUN --mount=type=secret,id=GITHUB_ACCESS_TOKEN,mode=0400,uid=1000,gid=1000 \
49+
GITHUB_ACCESS_TOKEN="$(cat /run/secrets/GITHUB_ACCESS_TOKEN)" \
50+
make -C /${PROJECT_NAME} install/build
6851

69-
# Install python versions
70-
RUN --mount=type=secret,id=GITHUB_ACCESS_TOKEN,env=GITHUB_ACCESS_TOKEN \
71-
make -C /${PROJECT_NAME} python312/install
72-
RUN pyenv global system $(pyenv versions | grep 3.12)
7352
RUN python --version \
7453
&& python3 --version \
75-
&& python3.12 --version
54+
&& python3.12 --version \
55+
&& python3.13 --version \
56+
&& python3.14 --version
7657

7758
WORKDIR /${PROJECT_NAME}
7859
ENTRYPOINT ["entrypoint.sh"]

0 commit comments

Comments
 (0)