Skip to content

Commit

Permalink
Merge pull request #170 from penumbra-zone/container-build-repair
Browse files Browse the repository at this point in the history
ci: fix containerfile build for monorepo layout
  • Loading branch information
ejmg authored Aug 13, 2024
2 parents 4c8245f + 96a1d38 commit edb8ba5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ node_modules
.env.development.local
.env.test.local
.env.production.local
.envrc

# Testing
coverage
Expand Down
17 changes: 10 additions & 7 deletions apps/web/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ 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
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit edb8ba5

Please sign in to comment.