-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and publish fromtend Docker container
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Publish frontend | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
publish: | ||
name: Publish frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
- name: Install Docker credentials | ||
run: echo "${GITHUB_TOKEN}" | docker login ghcr.io -u $ --password-stdin | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: frontend | ||
file: ./frontend/Dockerfile | ||
push: true | ||
tags: ghcr.io/buildbarn/bb-portal-frontend:${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Build frontend | ||
|
||
on: | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
publish: | ||
name: Publish frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
- name: Install Docker credentials | ||
run: echo "${GITHUB_TOKEN}" | docker login ghcr.io -u $ --password-stdin | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: frontend | ||
file: ./frontend/Dockerfile | ||
push: false | ||
tags: ghcr.io/buildbarn/bb-portal-frontend:${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
110,97,109,101,58,32,80,117,98,108,105,115,104,32,97,102,114,111,110,116,101,110,100,10,10,111,110,58,10,32,32,112,117,115,104,58,10,32,32,32,32,98,114,97,110,99,104,101,115,58,32,91,34,109,97,105,110,34,93,10,10,106,111,98,115,58,10,32,32,112,117,98,108,105,115,104,58,10,32,32,32,32,110,97,109,101,58,32,80,117,98,108,105,115,104,32,102,114,111,110,116,101,110,100,10,32,32,32,32,114,117,110,115,45,111,110,58,32,117,98,117,110,116,117,45,108,97,116,101,115,116,10,32,32,32,32,115,116,101,112,115,58,10,32,32,32,32,32,32,45,32,110,97,109,101,58,32,67,104,101,99,107,32,111,117,116,32,116,104,101,32,114,101,112,111,10,32,32,32,32,32,32,32,32,117,115,101,115,58,32,97,99,116,105,111,110,115,47,99,104,101,99,107,111,117,116,64,118,52,10,32,32,32,32,32,32,45,32,110,97,109,101,58,32,73,110,115,116,97,108,108,32,68,111,99,107,101,114,32,99,114,101,100,101,110,116,105,97,108,115,10,32,32,32,32,32,32,32,32,114,117,110,58,32,101,99,104,111,32,34,36,123,71,73,84,72,85,66,95,84,79,75,69,78,125,34,32,124,32,100,111,99,107,101,114,32,108,111,103,105,110,32,103,104,99,114,46,105,111,32,45,117,32,36,32,45,45,112,97,115,115,119,111,114,100,45,115,116,100,105,110,10,32,32,32,32,32,32,32,32,101,110,118,58,10,32,32,32,32,32,32,32,32,32,32,71,73,84,72,85,66,95,84,79,75,69,78,58,32,34,36,123,123,32,115,101,99,114,101,116,115,46,71,73,84,72,85,66,95,84,79,75,69,78,32,125,125,34,10,32,32,32,32,32,32,45,32,110,97,109,101,58,32,66,117,105,108,100,32,97,110,100,32,112,117,115,104,10,32,32,32,32,32,32,32,32,117,115,101,115,58,32,100,111,99,107,101,114,47,98,117,105,108,100,45,112,117,115,104,45,97,99,116,105,111,110,64,118,52,10,32,32,32,32,32,32,32,32,119,105,116,104,58,10,32,32,32,32,32,32,32,32,32,32,99,111,110,116,101,120,116,58,32,102,114,111,110,116,101,110,100,10,32,32,32,32,32,32,32,32,32,32,102,105,108,101,58,32,46,47,102,114,111,110,116,101,110,100,47,68,111,99,107,101,114,102,105,108,101,10,32,32,32,32,32,32,32,32,32,32,112,117,115,104,58,32,116,114,117,101,10,32,32,32,32,32,32,32,32,32,32,116,97,103,115,58,32,103,104,99,114,46,105,111,47,98,117,105,108,100,98,97,114,110,47,98,98,45,112,111,114,116,97,108,45,102,114,111,110,116,101,110,100,58,36,123,123,32,103,105,116,104,117,98,46,115,104,97,32,125,125,10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM node:22-alpine AS base | ||
|
||
# Install dependencies only when needed | ||
FROM base AS deps | ||
# 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 | ||
WORKDIR /app | ||
|
||
COPY package.json pnpm-lock.yaml ./ | ||
RUN corepack enable pnpm && pnpm i --frozen-lockfile | ||
|
||
# Rebuild the source code only when needed | ||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
RUN corepack enable pnpm && pnpm run build | ||
|
||
# Production image, copy all the files and run next | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV=production | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT=3000 | ||
|
||
# server.js is created by next build from the standalone output | ||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
ENV HOSTNAME="0.0.0.0" | ||
CMD ["node", "server.js"] |