Skip to content

Commit

Permalink
Use Node.js 20 and publish docker images (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughns authored May 7, 2024
1 parent 679aa2e commit 7b14f6b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ on:
pull_request:
branches: [main]

env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io

jobs:
test:
name: 'Test'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -31,6 +37,8 @@ jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -52,11 +60,49 @@ jobs:
- name: Docker build
run: docker build .

docker:
name: 'Docker publish'
needs: [test, build]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

deploy-demo:
name: Deploy demo site
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [test, build]
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine as builder
FROM --platform=${BUILDPLATFORM} node:20-alpine as builder

ARG DEFAULT_HOMESERVER

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

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

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

0 comments on commit 7b14f6b

Please sign in to comment.