Skip to content

Commit 7eeaa19

Browse files
committed
Update Dockerfiles and dependencies
1 parent 1841805 commit 7eeaa19

File tree

10 files changed

+2084
-1988
lines changed

10 files changed

+2084
-1988
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
FROM mcr.microsoft.com/devcontainers/python:2.0.2-3.13-trixie
1+
FROM mcr.microsoft.com/devcontainers/python:3.0.5-3.13-trixie
22

33
ENV PYTHONUNBUFFERED=1
44

5+
# Update and upgrade system packages for latest security fixes
6+
RUN apt-get update && apt-get upgrade -y && apt-get clean && rm -rf /var/lib/apt/lists/*
7+
58
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.
69
ARG USER_UID=1000
710
ARG USER_GID=$USER_UID

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33

4-
minimum_pre_commit_version: 4.3.0
4+
minimum_pre_commit_version: 4.5.1
55

66
repos:
77
- repo: local
@@ -19,7 +19,7 @@ repos:
1919
args: [--check]
2020
pass_filenames: false
2121
- repo: https://github.com/pre-commit/pre-commit-hooks
22-
rev: v5.0.0
22+
rev: v6.0.0
2323
hooks:
2424
- id: trailing-whitespace
2525
- id: end-of-file-fixer
@@ -45,13 +45,13 @@ repos:
4545
- id: no-commit-to-branch
4646
args: [--branch, dev, --branch, int, --branch, main]
4747
- repo: https://github.com/astral-sh/ruff-pre-commit
48-
rev: v0.13.1
48+
rev: v0.14.14
4949
hooks:
5050
- id: ruff
5151
args: [--fix, --exit-non-zero-on-fix]
5252
- id: ruff-format
5353
- repo: https://github.com/pre-commit/mirrors-mypy
54-
rev: v1.18.2
54+
rev: v1.19.1
5555
hooks:
5656
- id: mypy
5757
args: [--no-warn-unused-ignores]

.pyproject_generation/pyproject_custom.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ name = "my_microservice"
44
version = "0.1.0"
55
description = "My-Microservice - a short description"
66
dependencies = [
7-
"typer >= 0.19.1",
8-
"ghga-service-commons[api] >= 5.0",
9-
"ghga-event-schemas >= 10.0",
10-
"hexkit[akafka,s3,mongodb] >= 7.0",
7+
"typer >= 0.21.1",
8+
"ghga-service-commons[api] >= 6.1",
9+
"ghga-event-schemas ~= 11.1",
10+
"hexkit[akafka,s3,mongodb] >= 7.3",
1111
]
1212

1313
[project.urls]

.pyproject_generation/pyproject_template.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=80.9"]
2+
requires = ["setuptools>=80.10"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -101,7 +101,7 @@ check_untyped_defs = true
101101
no_site_packages = false
102102

103103
[tool.pytest.ini_options]
104-
minversion = "8.4"
104+
minversion = "9.0"
105105
asyncio_mode = "strict"
106106
asyncio_default_fixture_loop_scope = "function"
107107

Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,24 @@ RUN python -m build
2626

2727
# DEP-BUILDER: a container to (build and) install dependencies
2828
FROM base AS dep-builder
29-
RUN apk update
30-
RUN apk add build-base gcc g++ libffi-dev zlib-dev
31-
RUN apk upgrade --available
29+
RUN apk update && \
30+
apk add build-base gcc g++ libffi-dev zlib-dev && \
31+
apk upgrade --available
3232
WORKDIR /service
3333
COPY --from=builder /service/lock/requirements.txt /service
34-
RUN pip install --no-deps -r requirements.txt
34+
RUN pip install --no-cache-dir --no-deps -r requirements.txt
3535

3636
# RUNNER: a container to run the service
3737
FROM base AS runner
38+
# create new user first
39+
RUN adduser -D appuser
3840
WORKDIR /service
3941
RUN rm -rf /usr/local/lib/python3.13
4042
COPY --from=dep-builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
4143
COPY --from=builder /service/dist/ /service
42-
RUN pip install --no-deps *.whl
43-
RUN rm *.whl
44-
RUN adduser -D appuser
44+
RUN pip install --no-cache-dir --no-deps *.whl && \
45+
rm *.whl
46+
# switch to non-root user
4547
WORKDIR /home/appuser
4648
USER appuser
4749
ENV PYTHONUNBUFFERED=1

Dockerfile.debian

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
## creating building container
1717
FROM python:3.13-slim-trixie AS builder
1818
# update and install dependencies
19-
RUN apt update
20-
RUN apt upgrade -y
19+
RUN apt-get update && apt-get upgrade -y
2120
RUN pip install build
2221
# copy code
2322
COPY . /service
@@ -28,18 +27,21 @@ RUN python -m build
2827
# creating running container
2928
FROM python:3.13-slim-trixie
3029
# update and install dependencies
31-
RUN apt update
32-
RUN apt upgrade -y
30+
RUN apt-get update && \
31+
apt-get upgrade -y && \
32+
apt-get clean && \
33+
rm -rf /var/lib/apt/lists/*
34+
# create new user first
35+
RUN useradd --create-home appuser
3336
# copy and install requirements and wheel
3437
WORKDIR /service
3538
COPY --from=builder /service/lock/requirements.txt /service
36-
RUN pip install --no-deps -r requirements.txt
37-
RUN rm requirements.txt
39+
RUN pip install --no-cache-dir --no-deps -r requirements.txt && \
40+
rm requirements.txt
3841
COPY --from=builder /service/dist/ /service
39-
RUN pip install --no-deps *.whl
40-
RUN rm *.whl
41-
# create new user and execute as that user
42-
RUN useradd --create-home appuser
42+
RUN pip install --no-cache-dir --no-deps *.whl && \
43+
rm *.whl
44+
# switch to non-root user
4345
WORKDIR /home/appuser
4446
USER appuser
4547
# set environment

lock/requirements-dev-template.in

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
# common requirements for development and testing of services
22

3-
pytest>=8.4
4-
pytest-asyncio>=1.2.0
3+
pytest>=9.0
4+
pytest-asyncio>=1.3
55
pytest-cov>=7
66
snakeviz>=2.2
7-
logot>=1.5.1
7+
logot>=1.5
88

9-
pre-commit>=4.3
9+
pre-commit>=4.5
1010

11-
mypy>=1.18.2
12-
mypy-extensions>=1.1
11+
mypy>=1.19
1312

14-
ruff>=0.13.1
13+
ruff>=0.14.14
1514

1615
click>=8.3
17-
typer>=0.19.1
16+
typer>=0.21.1
1817

1918
httpx>=0.28.1
20-
pytest-httpx>=0.35
19+
pytest-httpx>=0.36
2120

22-
urllib3>=2.5
21+
urllib3>=2.6.3
2322
requests>=2.32.5
2423

2524
casefy>=1.1
2625
jsonschema2md>=1.7
27-
setuptools>=80.9
26+
setuptools>=80.10
2827

2928
# required since switch to pyproject.toml and pip-tools
30-
tomli>=2.2.1
3129
tomli_w>=1.2
3230

33-
uv>=0.8.19
31+
uv>=0.9.28

lock/requirements-dev.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
-r requirements-dev-template.in
55

66
# additional requirements can be listed here
7-
testcontainers[kafka,mongo]>=4.13
7+
testcontainers[kafka,mongo]>=4.14

0 commit comments

Comments
 (0)