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

fix: use python3.11 as base image #4121

Merged
merged 1 commit into from
Jun 6, 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: 7 additions & 2 deletions .github/workflows/api-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
max-parallel: 2
matrix:
python-version: ['3.11', '3.12']

steps:
- name: Cloning repo
uses: actions/checkout@v4
Expand All @@ -41,7 +46,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install Dependencies
Expand Down Expand Up @@ -70,7 +75,7 @@ jobs:
- name: Upload Coverage
uses: codecov/codecov-action@v4
env:
PYTHON: 3.12
PYTHON: ${{ matrix.python-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PYTHON
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ENV STATIC_ASSET_CDN_URL=/static/
RUN cd frontend && npm run bundledjango

# Step 2 - Build Python virtualenv
FROM python:3.12 as build-python
FROM python:3.11 as build-python
WORKDIR /app

COPY api/pyproject.toml api/poetry.lock api/Makefile ./
Expand All @@ -37,7 +37,7 @@ ARG POETRY_OPTS
RUN make install-packages opts="${POETRY_OPTS}"

# Step 3 - Build Django Application
FROM python:3.12-slim as application
FROM python:3.11-slim as application
WORKDIR /app

# Install SAML dependency if required
Expand All @@ -49,7 +49,7 @@ ARG TARGETARCH
RUN if [ "${TARGETARCH}" != "amd64" ]; then apt-get update && apt-get install -y libpq-dev && rm -rf /var/lib/apt/lists/*; fi;

# Copy the python venv from step 2
COPY --from=build-python /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=build-python /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
# Copy the bin folder as well to copy the executables created in package installation
COPY --from=build-python /usr/local/bin /usr/local/bin

Expand Down
6 changes: 3 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Step 1 - Build Python virtualenv
FROM python:3.12 as build-python
FROM python:3.11 as build-python
WORKDIR /app

COPY api/pyproject.toml api/poetry.lock api/Makefile ./
Expand All @@ -18,7 +18,7 @@ ARG POETRY_OPTS
RUN make install-packages opts="${POETRY_OPTS}"

# Step 2 - Build Django Application
FROM python:3.12-slim as application
FROM python:3.11-slim as application
WORKDIR /app

# Install SAML dependency if required
Expand All @@ -37,7 +37,7 @@ RUN --mount=type=secret,id=sse_pgp_pkey if [ -f /run/secrets/sse_pgp_pkey ]; th


# Copy the python venv from step 2
COPY --from=build-python /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=build-python /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
# Copy the bin folder as well to copy the executables created in package installation
COPY --from=build-python /usr/local/bin /usr/local/bin

Expand Down
95 changes: 92 additions & 3 deletions api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ authors = ["Flagsmith <support@flagsmith.com>"]
readme = "readme.md"

[tool.poetry.dependencies]
python = "~3.12"
python = ">=3.11, <3.13"
django = "~3.2.25"
rudder-sdk-python = "~2.0.2"
segment-analytics-python = "~2.2.3"
Expand Down
Loading