From e9a4515dfd97b952dd73734628e9034b077ef52a Mon Sep 17 00:00:00 2001 From: Oliver Gut Date: Mon, 5 Aug 2024 10:44:29 +0200 Subject: [PATCH 1/2] Use JSON arguments to make sure the executable can receive OS signals. --- src/api-legacy/Dockerfile | 4 ++-- src/api/Dockerfile | 4 ++-- src/client/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api-legacy/Dockerfile b/src/api-legacy/Dockerfile index b283fe890..a431e6454 100644 --- a/src/api-legacy/Dockerfile +++ b/src/api-legacy/Dockerfile @@ -11,9 +11,9 @@ ARG REVISION ENV APP_VERSION ${VERSION} ENV APP_REVISION ${REVISION} -CMD python -u bms/main.py \ +CMD ["/bin/sh", "-c", "python -u bms/main.py \ --pg-host=${DB_HOST} \ --pg-port=${DB_PORT} \ --pg-database=${DB_DATABASE} \ --pg-user=${DB_USERNAME} \ - --pg-password=${DB_PASSWORD} + --pg-password=${DB_PASSWORD}"] diff --git a/src/api/Dockerfile b/src/api/Dockerfile index 35edfd5ab..4d49acf07 100644 --- a/src/api/Dockerfile +++ b/src/api/Dockerfile @@ -12,7 +12,7 @@ ENV PATH $PATH:/root/.dotnet/tools COPY BDMS.csproj . RUN dotnet restore -ENTRYPOINT dotnet watch run --no-launch-profile +ENTRYPOINT ["dotnet", "watch", "run", "--no-launch-profile"] FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG VERSION @@ -55,4 +55,4 @@ HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1 # Switch to the non-root user 'app' defined in the base image USER $APP_UID -ENTRYPOINT dotnet "BDMS.dll" +ENTRYPOINT ["dotnet", "BDMS.dll"] diff --git a/src/client/Dockerfile b/src/client/Dockerfile index 7a0835f7d..b7136dbfc 100644 --- a/src/client/Dockerfile +++ b/src/client/Dockerfile @@ -17,7 +17,7 @@ COPY ./docs ./docs COPY ./mkdocs.yml ./ RUN mkdocs build -d ./public/help -ENTRYPOINT npm run start -- --host +ENTRYPOINT ["npm", "run", "start", "--", "--host"] FROM node:20-buster-slim AS deploy ARG VERSION From f03fccd0a4368c1426d36f3d935459818df01706 Mon Sep 17 00:00:00 2001 From: Oliver Gut Date: Mon, 5 Aug 2024 10:45:53 +0200 Subject: [PATCH 2/2] Use an equals sign to separate key and value instead of legacy `ENV key value` format. --- src/api-legacy/Dockerfile | 4 ++-- src/api/Dockerfile | 2 +- src/client/Dockerfile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api-legacy/Dockerfile b/src/api-legacy/Dockerfile index a431e6454..9246e6889 100644 --- a/src/api-legacy/Dockerfile +++ b/src/api-legacy/Dockerfile @@ -8,8 +8,8 @@ COPY . ./bms ARG VERSION ARG REVISION -ENV APP_VERSION ${VERSION} -ENV APP_REVISION ${REVISION} +ENV APP_VERSION=${VERSION} +ENV APP_REVISION=${REVISION} CMD ["/bin/sh", "-c", "python -u bms/main.py \ --pg-host=${DB_HOST} \ diff --git a/src/api/Dockerfile b/src/api/Dockerfile index 4d49acf07..73fda2052 100644 --- a/src/api/Dockerfile +++ b/src/api/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /src RUN apt-get -y update RUN apt-get -y install git vim curl htop RUN dotnet tool install --global dotnet-ef --version 8.0.0 -ENV PATH $PATH:/root/.dotnet/tools +ENV PATH=$PATH:/root/.dotnet/tools # Restore dependencies and tools COPY BDMS.csproj . diff --git a/src/client/Dockerfile b/src/client/Dockerfile index b7136dbfc..807d22bd0 100644 --- a/src/client/Dockerfile +++ b/src/client/Dockerfile @@ -1,7 +1,7 @@ FROM node:20-buster-slim AS development ARG VERSION ARG REVISION -ENV VITE_APP_VERSION ${VERSION}+${REVISION} +ENV VITE_APP_VERSION=${VERSION}+${REVISION} RUN apt-get -y update RUN apt-get -y install git vim curl htop python3 python3-pip RUN python3 -m pip install mkdocs @@ -22,7 +22,7 @@ ENTRYPOINT ["npm", "run", "start", "--", "--host"] FROM node:20-buster-slim AS deploy ARG VERSION ARG REVISION -ENV VITE_APP_VERSION ${VERSION}+${REVISION} +ENV VITE_APP_VERSION=${VERSION}+${REVISION} RUN apt-get -y update RUN apt-get -y install git