Skip to content

Commit a000ee6

Browse files
authored
Merge pull request #238 from ghga-de/feature/patch-dockerfile
Copy binaries from dep-builder
1 parent 02f6466 commit a000ee6

File tree

10 files changed

+214
-185
lines changed

10 files changed

+214
-185
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ 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.14.14
48+
rev: v0.15.0
4949
hooks:
5050
- id: ruff
5151
args: [--fix, --exit-non-zero-on-fix]

.pyproject_generation/pyproject_custom.toml

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

1313
[project.urls]

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ RUN apk update && \
3232
WORKDIR /service
3333
COPY --from=builder /service/lock/requirements.txt /service
3434
RUN pip install --no-cache-dir --no-deps -r requirements.txt
35+
# Binaries that are needed at runtime
36+
RUN mkdir -p /opt/runtime-bin
37+
RUN cp /usr/local/bin/opentelemetry-instrument /opt/runtime-bin/ 2>/dev/null || true
3538

3639
# RUNNER: a container to run the service
3740
FROM base AS runner
@@ -40,9 +43,9 @@ RUN adduser -D appuser
4043
WORKDIR /service
4144
RUN rm -rf /usr/local/lib/python3.13
4245
COPY --from=dep-builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
46+
COPY --from=dep-builder /opt/runtime-bin/ /usr/local/bin/
4347
COPY --from=builder /service/dist/ /service
44-
RUN pip install --no-cache-dir --no-deps *.whl && \
45-
rm *.whl
48+
RUN pip install --no-cache-dir --no-deps *.whl && rm *.whl
4649
# switch to non-root user
4750
WORKDIR /home/appuser
4851
USER appuser

Dockerfile.debian

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
## creating building container
16+
# creating building container
1717
FROM python:3.13-slim-trixie AS builder
1818
# update and install dependencies
1919
RUN apt-get update && apt-get upgrade -y
@@ -39,12 +39,12 @@ COPY --from=builder /service/lock/requirements.txt /service
3939
RUN pip install --no-cache-dir --no-deps -r requirements.txt && \
4040
rm requirements.txt
4141
COPY --from=builder /service/dist/ /service
42-
RUN pip install --no-cache-dir --no-deps *.whl && \
43-
rm *.whl
42+
RUN pip install --no-cache-dir --no-deps *.whl && rm *.whl
4443
# switch to non-root user
4544
WORKDIR /home/appuser
4645
USER appuser
4746
# set environment
4847
ENV PYTHONUNBUFFERED=1
48+
4949
# Please adapt to package name:
5050
ENTRYPOINT ["my-microservice"]

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ The service requires the following configuration parameters:
104104
- <a id="properties/port"></a>**`port`** *(integer)*: Port to expose the server on the specified host. Default: `8080`.
105105
- <a id="properties/auto_reload"></a>**`auto_reload`** *(boolean)*: A development feature. Set to `True` to automatically reload the server upon code changes. Default: `false`.
106106
- <a id="properties/workers"></a>**`workers`** *(integer)*: Number of workers processes to run. Default: `1`.
107+
- <a id="properties/timeout_keep_alive"></a>**`timeout_keep_alive`** *(integer)*: The time in seconds to keep an idle connection open for subsequent requests before closing it. This value should be higher than the timeout used by any client or reverse proxy to avoid premature connection closures. Default: `90`.
108+
109+
Examples:
110+
```json
111+
5
112+
```
113+
114+
```json
115+
90
116+
```
117+
118+
```json
119+
5400
120+
```
121+
107122
- <a id="properties/api_root_path"></a>**`api_root_path`** *(string)*: Root path at which the API is reachable. This is relative to the specified host and port. Default: `""`.
108123
- <a id="properties/openapi_url"></a>**`openapi_url`** *(string)*: Path to get the openapi specification in JSON format. This is relative to the specified host and port. Default: `"/openapi.json"`.
109124
- <a id="properties/docs_url"></a>**`docs_url`** *(string)*: Path to host the swagger documentation. This is relative to the specified host and port. Default: `"/docs"`.

config_schema.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@
7777
"title": "Workers",
7878
"type": "integer"
7979
},
80+
"timeout_keep_alive": {
81+
"default": 90,
82+
"description": "The time in seconds to keep an idle connection open for subsequent requests before closing it. This value should be higher than the timeout used by any client or reverse proxy to avoid premature connection closures.",
83+
"examples": [
84+
5,
85+
90,
86+
5400
87+
],
88+
"title": "Timeout Keep Alive",
89+
"type": "integer"
90+
},
8091
"api_root_path": {
8192
"default": "",
8293
"description": "Root path at which the API is reachable. This is relative to the specified host and port.",

example_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ openapi_url: /openapi.json
1616
port: 8080
1717
service_instance_id: '1'
1818
service_name: my_microservice
19+
timeout_keep_alive: 90
1920
workers: 1

0 commit comments

Comments
 (0)