Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Node.js 20 and publish docker images #29

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading