Skip to content

Commit 7b14f6b

Browse files
authored
Use Node.js 20 and publish docker images (#29)
1 parent 679aa2e commit 7b14f6b

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ on:
55
pull_request:
66
branches: [main]
77

8+
env:
9+
IMAGE_NAME: ${{ github.repository }}
10+
REGISTRY: ghcr.io
11+
812
jobs:
913
test:
1014
name: 'Test'
1115
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
1218
steps:
1319
- name: Checkout
1420
uses: actions/checkout@v4
@@ -31,6 +37,8 @@ jobs:
3137
build:
3238
name: 'Build'
3339
runs-on: ubuntu-latest
40+
permissions:
41+
contents: read
3442
steps:
3543
- name: Checkout
3644
uses: actions/checkout@v4
@@ -52,11 +60,49 @@ jobs:
5260
- name: Docker build
5361
run: docker build .
5462

63+
docker:
64+
name: 'Docker publish'
65+
needs: [test, build]
66+
runs-on: ubuntu-latest
67+
permissions:
68+
contents: read
69+
packages: write
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v3
73+
74+
- name: Set up Docker Buildx
75+
uses: docker/setup-buildx-action@v2
76+
77+
- name: Log into registry ${{ env.REGISTRY }}
78+
uses: docker/login-action@v2
79+
with:
80+
registry: ${{ env.REGISTRY }}
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Extract Docker metadata
85+
id: meta
86+
uses: docker/metadata-action@v4
87+
with:
88+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
89+
90+
- name: Build and push Docker image
91+
uses: docker/build-push-action@v3
92+
with:
93+
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
94+
tags: ${{ steps.meta.outputs.tags }}
95+
labels: ${{ steps.meta.outputs.labels }}
96+
platforms: linux/amd64,linux/arm64
97+
5598
deploy-demo:
5699
name: Deploy demo site
57100
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58101
needs: [test, build]
59102
runs-on: ubuntu-latest
103+
permissions:
104+
contents: read
105+
pages: write
60106
steps:
61107
- name: Checkout
62108
uses: actions/checkout@v4

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-alpine as builder
1+
FROM --platform=${BUILDPLATFORM} node:20-alpine as builder
22

33
ARG DEFAULT_HOMESERVER
44

@@ -13,6 +13,6 @@ COPY tsconfig.json webpack.config.js webpack.parts.js ./
1313
ENV DEFAULT_HOMESERVER ${DEFAULT_HOMESERVER}
1414
RUN yarn build
1515

16-
FROM nginxinc/nginx-unprivileged:1.21-alpine
16+
FROM --platform=${TARGETPLATFORM} nginxinc/nginx-unprivileged:1-alpine
1717

1818
COPY --from=builder /files-sdk-demo/dist /usr/share/nginx/html

0 commit comments

Comments
 (0)