From 1f35b3fc66afffc63bc042e1f582df6c0f57102a Mon Sep 17 00:00:00 2001 From: sbilge Date: Fri, 23 Aug 2024 09:48:46 +0000 Subject: [PATCH] template update --- .devcontainer/Dockerfile | 2 +- .template/mandatory_files.txt | 1 + Dockerfile.debian | 48 +++++++++++++++++++++++++++++++ lock/requirements-dev-template.in | 4 +-- 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.debian diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7eb17e2..b21af00 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,7 +8,7 @@ ARG USER_GID=$USER_UID RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi # [Option] Install Node.js -ARG INSTALL_NODE="true" +ARG INSTALL_NODE="false" ARG NODE_VERSION="lts/*" RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi diff --git a/.template/mandatory_files.txt b/.template/mandatory_files.txt index 660a15e..fcfb0f8 100644 --- a/.template/mandatory_files.txt +++ b/.template/mandatory_files.txt @@ -23,6 +23,7 @@ lock/requirements-dev.txt lock/requirements.txt Dockerfile +Dockerfile.debian config_schema.json example_config.yaml LICENSE diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 0000000..33dbe10 --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,48 @@ +# 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. + +## creating building container +FROM python:3.12-slim-bookworm AS builder +# update and install dependencies +RUN apt update +RUN apt upgrade -y +RUN pip install build +# copy code +COPY . /service +WORKDIR /service +# build wheel +RUN python -m build + +# creating running container +FROM python:3.12-slim-bookworm +# update and install dependencies +RUN apt update +RUN apt upgrade -y +# copy and install requirements and wheel +WORKDIR /service +COPY --from=builder /service/lock/requirements.txt /service +RUN pip install --no-deps -r requirements.txt +RUN rm requirements.txt +COPY --from=builder /service/dist/ /service +RUN pip install --no-deps *.whl +RUN rm *.whl +# create new user and execute as that user +RUN useradd --create-home appuser +WORKDIR /home/appuser +USER appuser +# set environment +ENV PYTHONUNBUFFERED=1 +# Please adapt to package name: +ENTRYPOINT ["my-microservice"] diff --git a/lock/requirements-dev-template.in b/lock/requirements-dev-template.in index dd81066..97ce387 100644 --- a/lock/requirements-dev-template.in +++ b/lock/requirements-dev-template.in @@ -1,7 +1,7 @@ # common requirements for development and testing of services pytest>=8.2 -pytest-asyncio>=0.23.6 +pytest-asyncio>=0.23.7 pytest-cov>=5 snakeviz>=2.2 logot>=1.3 @@ -29,4 +29,4 @@ setuptools>=69.5 # required since switch to pyproject.toml and pip-tools tomli_w>=1.0 -uv>=0.1.44 +uv>=0.2.13