* chore: update workflow actions and docker build secrets * fix: preserve existing mise config * chore: update build-push action to version 1.5.1 across workflows * chore: use @major action versions and guard Dockerfile secret exports - Switch all GitHub Actions from pinned versions (@v4.2.1) to major tags (@v4) per GitHub convention. - Guard /run/secrets/ exports in Dockerfiles with '[ -s ... ]' checks so missing optional secrets don't export empty env vars. Amp-Thread-ID: https://ampcode.com/threads/T-019d4b84-83d7-7455-b971-e5639998ef4f Co-authored-by: Amp <[email protected]> --------- Co-authored-by: akshat5302 <[email protected]> Co-authored-by: Amp <[email protected]>
93 lines
3.5 KiB
Docker
93 lines
3.5 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
FROM node:22-alpine AS base
|
|
|
|
# Setup pnpm package manager with corepack and configure global bin directory for caching
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
|
|
# *****************************************************************************
|
|
# STAGE 1: Prune the project
|
|
# *****************************************************************************
|
|
FROM base AS builder
|
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
|
RUN apk update
|
|
RUN apk add --no-cache libc6-compat
|
|
# Set working directory
|
|
WORKDIR /app
|
|
ARG TURBO_VERSION=2.8.21
|
|
RUN corepack enable pnpm && pnpm add -g turbo@${TURBO_VERSION}
|
|
COPY . .
|
|
RUN turbo prune --scope=plane-runner-host --docker
|
|
|
|
# *****************************************************************************
|
|
# STAGE 2: Install dependencies & build the project
|
|
# *****************************************************************************
|
|
# Add lockfile and package.json's of isolated subworkspace
|
|
FROM base AS installer
|
|
RUN apk update
|
|
RUN apk add --no-cache libc6-compat
|
|
WORKDIR /app
|
|
|
|
# First install dependencies (as they change less often)
|
|
COPY .gitignore .gitignore
|
|
COPY --from=builder /app/out/json/ .
|
|
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
|
RUN corepack enable pnpm
|
|
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm fetch --store-dir=/pnpm/store
|
|
|
|
# Build the project and its dependencies
|
|
COPY --from=builder /app/out/full/ .
|
|
COPY turbo.json turbo.json
|
|
ENV CI=true
|
|
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --store-dir=/pnpm/store
|
|
|
|
ENV TURBO_TELEMETRY_DISABLED=1
|
|
|
|
RUN --mount=type=secret,id=TURBO_TOKEN,required=false \
|
|
--mount=type=secret,id=TURBO_REMOTE_CACHE_SIGNATURE_KEY,required=false \
|
|
--mount=type=secret,id=SENTRY_AUTH_TOKEN,required=false \
|
|
sh -ec 'if [ -s /run/secrets/TURBO_TOKEN ]; then export TURBO_TOKEN="$(cat /run/secrets/TURBO_TOKEN)"; fi; \
|
|
if [ -s /run/secrets/TURBO_REMOTE_CACHE_SIGNATURE_KEY ]; then export TURBO_REMOTE_CACHE_SIGNATURE_KEY="$(cat /run/secrets/TURBO_REMOTE_CACHE_SIGNATURE_KEY)"; fi; \
|
|
if [ -s /run/secrets/SENTRY_AUTH_TOKEN ]; then export SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)"; fi; \
|
|
pnpm turbo run build --filter=plane-runner-host'
|
|
|
|
# *****************************************************************************
|
|
# STAGE 3: Run the project
|
|
# *****************************************************************************
|
|
FROM registry.access.redhat.com/ubi10/nodejs-22 AS runner
|
|
|
|
USER root
|
|
|
|
RUN dnf install -y shadow-utils crypto-policies crypto-policies-scripts && dnf clean all
|
|
|
|
RUN update-crypto-policies --set FIPS
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=installer /app/apps/runners/node-runner/dist ./apps/runners/node-runner/dist
|
|
COPY --from=installer /app/apps/runners/node-runner/node_modules ./apps/runners/node-runner/node_modules
|
|
COPY --from=installer /app/apps/runners/node-runner/package.json ./apps/runners/node-runner/package.json
|
|
COPY --from=installer /app/node_modules ./node_modules
|
|
|
|
# Directory where script packages will be installed at runtime
|
|
RUN mkdir -p /app/scripts
|
|
|
|
COPY LICENSE.txt .
|
|
RUN mkdir -p /usr/share/licenses/plane/
|
|
COPY LICENSE.txt /usr/share/licenses/plane/LICENSE.txt
|
|
|
|
RUN groupadd -g 1000 node && useradd -u 1000 -g node -s /bin/sh -d /app node
|
|
|
|
RUN chown -R node:node /app
|
|
|
|
USER node
|
|
|
|
ENV NODE_ENV=production
|
|
ENV TURBO_TELEMETRY_DISABLED=1
|
|
ENV NPM_CONFIG_CACHE=/tmp/.npm-cache
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "apps/runners/node-runner/dist/index.mjs"]
|