generated from ghga-de/microservice-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
22,489 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln | ||
# for the German Human Genome-Phenome Archive (GHGA) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# BASE: a base image with updated packages | ||
FROM python:3.12-alpine AS base | ||
RUN apk upgrade --no-cache --available | ||
|
||
# BUILDER: a container to build the service wheel | ||
FROM base AS builder | ||
RUN pip install build | ||
COPY . /service | ||
WORKDIR /service | ||
RUN python -m build | ||
|
||
# DEP-BUILDER: a container to (build and) install dependencies | ||
FROM base AS dep-builder | ||
RUN apk update | ||
RUN apk add build-base gcc g++ libffi-dev zlib-dev | ||
RUN apk upgrade --available | ||
WORKDIR /service | ||
COPY --from=builder /service/lock/requirements.txt /service | ||
RUN pip install --no-deps -r requirements.txt | ||
RUN echo $(find / -name opentelemetry-instrument) | ||
|
||
# RUNNER: a container to run the service | ||
FROM base AS runner | ||
WORKDIR /service | ||
RUN rm -rf /usr/local/lib/python3.12 | ||
COPY --from=dep-builder /usr/local/lib/python3.12 /usr/local/lib/python3.12 | ||
COPY --from=builder /service/dist/ /service | ||
COPY --from=dep-builder /usr/local/bin/opentelemetry-instrument /usr/local/bin | ||
RUN pip install --no-deps *.whl | ||
RUN rm *.whl | ||
RUN adduser -D appuser | ||
WORKDIR /home/appuser | ||
USER appuser | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
ENTRYPOINT ["opentelemetry-instrument", "--traces_export", "console", "--metrics_exporter", "console", "--logs_export", "console", "dcs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!-- | ||
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln | ||
for the German Human Genome-Phenome Archive (GHGA) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# Lock Files | ||
|
||
This directory contains two lock files locking the dependencies of this microservice: | ||
|
||
The [`./requirements.txt`](./requirements.txt) contains production dependencies. | ||
|
||
The [`./requirements-dev.txt`](./requirements-dev.txt) additionally contains development | ||
dependencies. | ||
|
||
## Sources | ||
|
||
For generating the production lock file, only the dependencies specified in the | ||
[`../pyproject.toml`](../pyproject.toml) are considered as input. | ||
|
||
For generating the development lock file, additionally, the | ||
[`./requirements-dev-template.in`](./requirements-dev-template.in) as well as | ||
the [`./requirements-dev.in`](./requirements-dev.in) are considered. | ||
|
||
The `./requirements-dev-template.in` is automatically updated from the template | ||
repository and should not be manually modified. | ||
|
||
If you require additional dev dependencies not part of the | ||
`./requirements-dev-template.in`, you can add them to the | ||
`./requirements-dev.in`. | ||
|
||
## Update and Upgrade | ||
|
||
The lock files can be updated running the | ||
[`../scripts/update_lock.py`](../scripts/update_lock.py) script. This will keep the | ||
dependency versions in the lockfile unchanged unless they are in conflict with the | ||
the input sources. In that case, the affected dependencies are updated to the latest | ||
versions compatible with the input. | ||
|
||
If you would like to upgrade all dependencies in the lock file to the latest versions | ||
compatible with the input, you can run `../scripts/update_lock.py --upgrade`. | ||
|
||
If you just want to check if the script would do update, you can run | ||
`../scripts/update_lock.py --check`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# common requirements for development and testing of services | ||
|
||
pytest>=8.2 | ||
pytest-asyncio>=0.23.7 | ||
pytest-cov>=5 | ||
snakeviz>=2.2 | ||
logot>=1.3 | ||
|
||
pre-commit>=3.7 | ||
|
||
mypy>=1.10 | ||
mypy-extensions>=1.0 | ||
|
||
ruff>=0.4 | ||
|
||
click>=8.1 | ||
typer>=0.12 | ||
|
||
httpx>=0.27 | ||
pytest-httpx>=0.30 | ||
|
||
urllib3>=1.26.18 | ||
requests>=2.31 | ||
|
||
stringcase>=1.2 | ||
jsonschema2md>=1.1 | ||
setuptools>=69.5 | ||
|
||
# required since switch to pyproject.toml and pip-tools | ||
tomli_w>=1.0 | ||
|
||
uv>=0.2.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# requirements for development and testing this service | ||
|
||
# template requirements for development and testing | ||
-r requirements-dev-template.in | ||
|
||
# additional requirements can be listed here | ||
testcontainers[kafka,mongo]>=4.6.0 |
Oops, something went wrong.