Skip to content

Commit dbddc33

Browse files
Update Dockerfile and .devcontainer.json to use Node.js 24; add GitHub Actions workflow for container build and publish
1 parent ea1438e commit dbddc33

3 files changed

Lines changed: 60 additions & 3 deletions

File tree

.devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/typescript-node
33
{
44
"name": "Open Home Foundation - API",
5-
"image": "mcr.microsoft.com/devcontainers/typescript-node:22-bookworm",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:24-bookworm",
66
"forwardPorts": [
77
443
88
],
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and publish container
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['v*']
7+
pull_request:
8+
branches: [main]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to GitHub Container Registry
29+
if: github.event_name != 'pull_request'
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=ref,event=pr
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=sha
47+
type=raw,value=latest,enable={{is_default_branch}}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1.7
22

3-
FROM node:20-alpine AS builder
3+
FROM node:24-alpine AS builder
44
WORKDIR /app
55
RUN corepack enable
66
COPY package.json pnpm-lock.yaml ./
@@ -9,7 +9,7 @@ COPY tsconfig.json nest-cli.json ./
99
COPY src ./src
1010
RUN pnpm run build
1111

12-
FROM node:20-alpine AS runner
12+
FROM node:24-alpine AS runner
1313
WORKDIR /app
1414
ENV NODE_ENV=production
1515
ENV PORT=3000

0 commit comments

Comments
 (0)