From 84ab4dcb8b20aa0f51672eb0f8585e75823310dc Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 25 May 2025 21:45:42 +0300 Subject: [PATCH] chore(docker): format Dockerfiles --- apps/server/Dockerfile | 44 +++++++++++++++++------------------ apps/server/Dockerfile.alpine | 38 +++++++++++++++--------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/apps/server/Dockerfile b/apps/server/Dockerfile index 1e357f6fe..dbb021f58 100644 --- a/apps/server/Dockerfile +++ b/apps/server/Dockerfile @@ -1,28 +1,28 @@ FROM node:22.16.0-bullseye-slim AS builder - RUN corepack enable +RUN corepack enable - # Install native dependencies since we might be building cross-platform. - WORKDIR /usr/src/app/build - COPY ./docker/package.json ./docker/pnpm-workspace.yaml /usr/src/app/ - # We have to use --no-frozen-lockfile due to CKEditor patches - RUN pnpm install --no-frozen-lockfile --prod && pnpm rebuild +# Install native dependencies since we might be building cross-platform. +WORKDIR /usr/src/app/build +COPY ./docker/package.json ./docker/pnpm-workspace.yaml /usr/src/app/ +# We have to use --no-frozen-lockfile due to CKEditor patches +RUN pnpm install --no-frozen-lockfile --prod && pnpm rebuild FROM node:22.16.0-bullseye-slim - # Install only runtime dependencies - RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - gosu && \ - rm -rf \ - /var/lib/apt/lists/* \ - /var/cache/apt/* +# Install only runtime dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gosu && \ + rm -rf \ + /var/lib/apt/lists/* \ + /var/cache/apt/* - WORKDIR /usr/src/app - COPY ./dist /usr/src/app - RUN rm -rf /usr/src/app/node_modules/better-sqlite3 - COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /usr/src/app/node_modules/better-sqlite3 - COPY ./start-docker.sh /usr/src/app +WORKDIR /usr/src/app +COPY ./dist /usr/src/app +RUN rm -rf /usr/src/app/node_modules/better-sqlite3 +COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /usr/src/app/node_modules/better-sqlite3 +COPY ./start-docker.sh /usr/src/app - # Configure container - EXPOSE 8080 - CMD [ "sh", "./start-docker.sh" ] - HEALTHCHECK --start-period=10s CMD exec gosu node node /usr/src/app/docker_healthcheck.cjs \ No newline at end of file +# Configure container +EXPOSE 8080 +CMD [ "sh", "./start-docker.sh" ] +HEALTHCHECK --start-period=10s CMD exec gosu node node /usr/src/app/docker_healthcheck.cjs \ No newline at end of file diff --git a/apps/server/Dockerfile.alpine b/apps/server/Dockerfile.alpine index 24d0dcb12..3b96950f1 100644 --- a/apps/server/Dockerfile.alpine +++ b/apps/server/Dockerfile.alpine @@ -1,26 +1,26 @@ FROM node:22.16.0-alpine AS builder - RUN corepack enable +RUN corepack enable - # Install native dependencies since we might be building cross-platform. - WORKDIR /usr/src/app - COPY ./docker/package.json ./docker/pnpm-workspace.yaml /usr/src/app/ - # We have to use --no-frozen-lockfile due to CKEditor patches - RUN pnpm install --no-frozen-lockfile --prod && pnpm rebuild +# Install native dependencies since we might be building cross-platform. +WORKDIR /usr/src/app +COPY ./docker/package.json ./docker/pnpm-workspace.yaml /usr/src/app/ +# We have to use --no-frozen-lockfile due to CKEditor patches +RUN pnpm install --no-frozen-lockfile --prod && pnpm rebuild FROM node:22.16.0-alpine - # Install runtime dependencies - RUN apk add --no-cache su-exec shadow +# Install runtime dependencies +RUN apk add --no-cache su-exec shadow - WORKDIR /usr/src/app - COPY ./dist /usr/src/app - RUN rm -rf /usr/src/app/node_modules/better-sqlite3 - COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /usr/src/app/node_modules/better-sqlite3 - COPY ./start-docker.sh /usr/src/app +WORKDIR /usr/src/app +COPY ./dist /usr/src/app +RUN rm -rf /usr/src/app/node_modules/better-sqlite3 +COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /usr/src/app/node_modules/better-sqlite3 +COPY ./start-docker.sh /usr/src/app - # Add application user - RUN adduser -s /bin/false node; exit 0 +# Add application user +RUN adduser -s /bin/false node; exit 0 - # Configure container - EXPOSE 8080 - CMD [ "sh", "./start-docker.sh" ] - HEALTHCHECK --start-period=10s CMD exec su-exec node node /usr/src/app/docker_healthcheck.cjs \ No newline at end of file +# Configure container +EXPOSE 8080 +CMD [ "sh", "./start-docker.sh" ] +HEALTHCHECK --start-period=10s CMD exec su-exec node node /usr/src/app/docker_healthcheck.cjs \ No newline at end of file