Skip to content

Commit

Permalink
Removed obsolet code
Browse files Browse the repository at this point in the history
  • Loading branch information
max-pfeiffer committed Dec 17, 2023
1 parent 03e3e9f commit 196b34c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 148 deletions.
1 change: 0 additions & 1 deletion .env-example
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
PYTHON_VERSION=3.12.0
OS_VARIANT=slim-bookworm
POETRY_VERSION=1.6.1
27 changes: 0 additions & 27 deletions build/constants.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
TARGET_ARCHITECTURES: list[str] = [
"python3.9.16-bullseye",
"python3.9.16-slim-bullseye",
"python3.10.10-bullseye",
"python3.10.10-slim-bullseye",
]
BASE_IMAGES: dict = {
TARGET_ARCHITECTURES[
0
]: "pfeiffermax/python-poetry:1.2.0-poetry1.4.1-python3.9.16-bullseye@sha256:54037cfdca026b17e7a57664dff47bf04e7849074d3ab62271ecad0446ef0322",
TARGET_ARCHITECTURES[
1
]: "pfeiffermax/python-poetry:1.2.0-poetry1.4.1-python3.9.16-slim-bullseye@sha256:c0b8d9c28c5717074c481dfdf1d8bd3aaa0b83a5e2a9e37c77be7af19d70d0ce",
TARGET_ARCHITECTURES[
2
]: "pfeiffermax/python-poetry:1.2.0-poetry1.4.1-python3.10.10-bullseye@sha256:5a81c8c86132e504db2b7329f5e41cd32bddebf811d83a0d356edbca0d81135c",
TARGET_ARCHITECTURES[
3
]: "pfeiffermax/python-poetry:1.2.0-poetry1.4.1-python3.10.10-slim-bullseye@sha256:289c6beb568991811629c91cdcb3841ceb95bf0a017c3e411f4b71e18043ef15",
}
PYTHON_VERSIONS: dict = {
TARGET_ARCHITECTURES[0]: "3.9.16",
TARGET_ARCHITECTURES[1]: "3.9.16",
TARGET_ARCHITECTURES[2]: "3.10.10",
TARGET_ARCHITECTURES[3]: "3.10.10",
}

# As we are running the server with an unprivileged user, we need to use
# a high port.
APPLICATION_SERVER_PORT: str = "8000"
Expand Down
116 changes: 0 additions & 116 deletions build/images.py

This file was deleted.

10 changes: 8 additions & 2 deletions build/publish.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import click
from build.constants import PLATFORMS, APPLICATION_SERVER_PORT
from build.utils import get_context, get_image_reference
from build.utils import (
get_context,
get_image_reference,
get_python_poetry_image_reference,
)
from pathlib import Path
from python_on_whales import DockerClient, Builder
from os import getenv
Expand Down Expand Up @@ -71,7 +75,9 @@ def main(
docker_client.buildx.build(
context_path=context,
build_args={
"BASE_IMAGE": f"pfeiffermax/python-poetry:1.8.0-poetry1.7.1-python{python_version}-{os_variant}",
"BASE_IMAGE": get_python_poetry_image_reference(
python_version, os_variant
),
"APPLICATION_SERVER_PORT": APPLICATION_SERVER_PORT,
},
tags=image_reference,
Expand Down
8 changes: 8 additions & 0 deletions build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ def get_image_reference(
) -> str:
reference: str = f"{registry}/pfeiffermax/uvicorn-poetry:{image_version}-python{python_version}-{os_variant}"
return reference


def get_python_poetry_image_reference(
python_version: str,
os_variant: str,
) -> str:
reference: str = f"pfeiffermax/python-poetry:1.8.0-poetry1.7.1-python{python_version}-{os_variant}"
return reference
10 changes: 8 additions & 2 deletions tests/build_image/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from python_on_whales import Builder, DockerClient

from build.constants import PLATFORMS, APPLICATION_SERVER_PORT
from build.utils import get_image_reference, get_context
from build.utils import (
get_image_reference,
get_context,
get_python_poetry_image_reference,
)
from tests.constants import REGISTRY_PASSWORD, REGISTRY_USERNAME
from tests.registry_container import DockerRegistryContainer
from tests.utils import (
Expand Down Expand Up @@ -68,7 +72,9 @@ def base_image_reference(
docker_client.buildx.build(
context_path=get_context(),
build_args={
"BASE_IMAGE": f"pfeiffermax/python-poetry:1.8.0-poetry1.7.1-python{python_version}-{os_variant}",
"BASE_IMAGE": get_python_poetry_image_reference(
python_version, os_variant
),
"APPLICATION_SERVER_PORT": APPLICATION_SERVER_PORT,
},
tags=image_reference,
Expand Down

0 comments on commit 196b34c

Please sign in to comment.