Skip to content

Commit

Permalink
Enable multi arch frontend images and update ubuntu to 24.04 on CI (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
evroon authored Feb 12, 2025
1 parent 0e8bfc2 commit a64685c
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:

jobs:
dependabot:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'evroon/bracket'
steps:
- name: Enable auto-merge for Dependabot PRs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

services:
postgres:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
update-contributors-readme:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Update contributors in README.md
steps:
- name: Contribute List
Expand All @@ -19,7 +19,7 @@ jobs:
pr_title_on_protected: "Update contributors in readme"

update-contributors-docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Update contributors in docs
steps:
- name: Contribute List
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-pretranslate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
trigger_crowdin_tm:
name: Crowdin Translation Memory Trigger
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
# Prevent this workflow from running (and failing) on forks
if: github.repository == 'evroon/bracket'
steps:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: docker

on:
workflow_dispatch:
pull_request:
paths:
- 'backend/**'
- 'frontend/**'
- 'docker-compose.yml'
push:
branches:
- 'master'

jobs:
build-and-push-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build frontend Docker image
uses: docker/build-push-action@v6
with:
context: frontend
push: false
file: frontend/Dockerfile
tags: ${{ steps.meta_frontend.outputs.tags }}
labels: ${{ steps.meta_frontend.outputs.labels }}
# Don't build linux/arm64/v8 because it's very slow with QEMU
platforms: linux/amd64

- name: Build backend Docker image
uses: docker/build-push-action@v6
with:
context: backend
push: false
file: backend/Dockerfile
tags: ${{ steps.meta_backend.outputs.tags }}
labels: ${{ steps.meta_backend.outputs.labels }}
# Don't build linux/arm64/v8 because it's very slow with QEMU
platforms: linux/amd64
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

jobs:
build-and-push-image:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
Expand All @@ -29,36 +29,36 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/#-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
uses: docker/#-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for frontend Docker image
id: meta_frontend
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_FRONTEND }}

- name: Extract metadata (tags, labels) for backend Docker image
id: meta_backend
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}

- name: Build and push frontend Docker image
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991
uses: docker/build-push-action@v6
with:
context: frontend
push: true
file: frontend/Dockerfile
tags: ${{ steps.meta_frontend.outputs.tags }}
labels: ${{ steps.meta_frontend.outputs.labels }}
platforms: linux/amd64
platforms: linux/amd64,linux/arm64/v8

- name: Build and push backend Docker image
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991
uses: docker/build-push-action@v6
with:
context: backend
push: true
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/docker.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
stale:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/stale@v9
with:
Expand Down
10 changes: 6 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ WORKDIR /app

COPY package.json yarn.lock ./

RUN yarn
# Increase timeout for slow QEMU arm64 builds
# https://github.com/nodejs/docker-node/issues/1335
RUN yarn --network-timeout 1000000

# Rebuild the source code only when needed
FROM node:18-alpine AS builder
FROM node:22-alpine AS builder

WORKDIR /app

Expand All @@ -20,11 +22,11 @@ RUN NEXT_PUBLIC_API_BASE_URL=http://NEXT_PUBLIC_API_BASE_URL_PLACEHOLDER \
yarn build

# Production image, copy all the files and run next
FROM node:18-alpine AS runner
FROM node:22-alpine AS runner

WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production

COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
Expand Down

0 comments on commit a64685c

Please # to comment.