Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize dockerfiles with best practices #1436

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api-legacy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ COPY . ./bms

ARG VERSION
ARG REVISION
ENV APP_VERSION ${VERSION}
ENV APP_REVISION ${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}"]
6 changes: 3 additions & 3 deletions src/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ 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 .
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
Expand Down Expand Up @@ -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"]
6 changes: 3 additions & 3 deletions src/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,12 +17,12 @@ 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
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

Expand Down
Loading