-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: fix containerfile build for monorepo layout #170
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ jobs: | |
with: | ||
context: . | ||
platforms: linux/amd64 | ||
file: Containerfile | ||
file: apps/web/Containerfile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ node_modules | |
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.envrc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I use a local |
||
|
||
# Testing | ||
coverage | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,22 @@ LABEL maintainer="[email protected]" | |
|
||
# provide pnpm globally for dep installing and building | ||
FROM alpine AS base | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Porting this no-telem env var across all build stages... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol, great catch. Very obnoxious to keep track of. |
||
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 | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICT the |
||
|
||
CMD node apps/web/server.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line
!apps/*/src/
looks to me like it should be sufficient to get theapps/web/src/*
directory allowed, but it wasn't working. To resolve, I added!apps/
and I'm calling it a day.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely assumed that
!apps/*/src
would expand to include any subdirectories so great catch!