1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-18 01:53:49 -05:00

update dockerfiles

This commit is contained in:
AJ Mabry 2025-06-17 13:29:39 -04:00
parent 71fed60689
commit eeddc1f620
No known key found for this signature in database
GPG Key ID: 959B72506842FAE9
8 changed files with 29 additions and 8 deletions

View File

@ -1,3 +1,14 @@
###############################################
# Node.js build stage #
###############################################
FROM node:20-alpine AS node-build
WORKDIR /app
COPY src/Admin/package*.json ./
COPY /src/Admin/ .
RUN npm ci
RUN npm run build
###############################################
# Build stage #
###############################################
@ -20,12 +31,13 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
&& echo "RID=$RID" > /tmp/rid.txt
# Set up Node
ARG NODE_VERSION=20
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm@latest && \
rm -rf /var/lib/apt/lists/*
# ARG NODE_VERSION=20
# RUN apk add --no-cache "nodejs~${NODE_VERSION}" "npm"
# RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
# && apt-get update \
# && apt-get install -y nodejs \
# && npm install -g npm@latest && \
# rm -rf /var/lib/apt/lists/*
# Copy required project files
WORKDIR /source
@ -33,11 +45,11 @@ COPY . ./
# Restore project dependencies and tools
WORKDIR /source/src/Admin
RUN npm ci
#RUN npm ci
RUN . /tmp/rid.txt && dotnet restore -r $RID
# Build project
RUN npm run build
#RUN npm run build
RUN . /tmp/rid.txt && dotnet publish \
-c release \
--no-restore \
@ -60,12 +72,15 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
tzdata \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*
# Copy app from the build stage
WORKDIR /app
COPY --from=build /source/src/Admin/out /app
COPY --from=node-build /app/wwwroot /app/wwwroot
COPY ./src/Admin/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

View File

@ -51,6 +51,7 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*

View File

@ -51,6 +51,7 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*

View File

@ -51,6 +51,7 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*

View File

@ -50,6 +50,7 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*

View File

@ -51,6 +51,7 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*

View File

@ -51,6 +51,7 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
EXPOSE 5000
RUN apk add curl \
icu-libs \
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu \
&& rm -rf /var/cache/apk/*