Skip to content
Open
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
50 changes: 0 additions & 50 deletions .github/workflows/docker-publish-njsPC-linux.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/push-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and Push Multi-arch Docker Image

on:
push:
branches: [ "master" ]
tags:
- "v*.*.*"
workflow_dispatch:

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

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

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

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,format=long
type=ref,event=branch
latest

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
35 changes: 24 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
FROM node:18-alpine as build
RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata
FROM node:23-alpine AS builder

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build
RUN npm ci --production

FROM node:18-alpine
RUN apk add git
RUN mkdir /app && chown node:node /app && mkdir /app/data && chown node:node /app/data
FROM node:23-alpine AS runner

WORKDIR /app
COPY --chown=node:node --from=build /app .
USER node
ENV NODE_ENV=production
EXPOSE 4200
ENTRYPOINT ["node", "dist/app.js"]

RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 -G nodejs \
&& apk add git tzdata

ENV NODE_ENV production

COPY --from=builder --chown=nodejs:nodejs /app ./
#hacky way to fix permissions
USER root
RUN chown nodejs:nodejs /app
USER nodejs

EXPOSE 5150

CMD ["node", "dist/app.js"]