diff --git a/.dockerignore b/.dockerignore index 7733942..ca24860 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,12 +9,13 @@ # nextjs files -!apps/*/src/ -!apps/*/public/ -!apps/*/.next/ -!apps/*/*.ts +!apps/ !apps/*/*.js !apps/*/*.json +!apps/*/*.ts +!apps/*/.next/ +!apps/*/public/ +!apps/*/src/ !public/ !src/ diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index b068c52..a38c51f 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -45,7 +45,7 @@ jobs: with: context: . platforms: linux/amd64 - file: Containerfile + file: apps/web/Containerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index c38b9a0..156ac9f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ node_modules .env.development.local .env.test.local .env.production.local +.envrc # Testing coverage diff --git a/apps/web/Containerfile b/apps/web/Containerfile index 50438c4..0eca07d 100644 --- a/apps/web/Containerfile +++ b/apps/web/Containerfile @@ -4,6 +4,7 @@ LABEL maintainer="team@penumbralabs.xyz" # provide pnpm globally for dep installing and building FROM alpine AS base +ENV NEXT_TELEMETRY_DISABLED=1 ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable pnpm @@ -11,12 +12,14 @@ RUN pnpm install turbo --global # prune package structure + code into out/ FROM base AS builder -# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. -RUN apk add --no-cache libc6-compat +ENV NEXT_TELEMETRY_DISABLED=1 +# 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 -COPY . . +COPY . /app +WORKDIR /app/apps/web RUN turbo prune --scope=cuiloa-app --docker # Install and build app @@ -26,7 +29,7 @@ RUN apk update WORKDIR /app # Disable build time telemetry. -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_TELEMETRY_DISABLED=1 # grab dependencies COPY .gitignore .gitignore @@ -45,7 +48,7 @@ FROM alpine AS runner WORKDIR /app # Disable telemetry. -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_TELEMETRY_DISABLED=1 # Don't run production as root RUN addgroup --system --gid 1001 nodejs @@ -59,6 +62,6 @@ COPY --from=installer /app/apps/web/package.json . # https://nextjs.org/docs/advanced-features/output-file-tracing COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./ COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static -COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public +# COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public CMD node apps/web/server.js