Skip to content

Commit e52b90d

Browse files
authored
Merge pull request #86 from treyrich/master
Adding workflow for publishing to docker hub
2 parents bc5fc4b + 9d6e90e commit e52b90d

2 files changed

Lines changed: 53 additions & 2 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Docker Image - Ubuntu
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- "v*.*.*"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Docker meta
16+
id: meta
17+
uses: docker/metadata-action@v5
18+
with:
19+
# list of Docker images to use as base name for tags
20+
images: |
21+
tagyoureit/njspc-dashpanel
22+
# generate Docker tags based on the following events/attributes
23+
tags: |
24+
type=schedule
25+
type=ref,event=branch
26+
type=ref,event=pr
27+
type=semver,pattern={{version}}
28+
type=semver,pattern={{major}}.{{minor}}
29+
type=semver,pattern={{major}}
30+
type=sha
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Login to Docker Hub
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
- name: Build and push combined Docker image
45+
uses: docker/build-push-action@v6
46+
with:
47+
push: true
48+
platforms: linux/amd64,linux/arm64,linux/arm/v7
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:lts-alpine as build
1+
FROM node:18-alpine as build
22
RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata
33
WORKDIR /app
44
COPY package*.json ./
@@ -7,11 +7,12 @@ COPY . .
77
RUN npm run build
88
RUN npm ci --production
99

10-
FROM node:lts-alpine
10+
FROM node:18-alpine
1111
RUN apk add git
1212
RUN mkdir /app && chown node:node /app && mkdir /app/data && chown node:node /app/data
1313
WORKDIR /app
1414
COPY --chown=node:node --from=build /app .
1515
USER node
1616
ENV NODE_ENV=production
17+
EXPOSE 4200
1718
ENTRYPOINT ["node", "dist/app.js"]

0 commit comments

Comments
 (0)