Skip to content

Commit 10e2e94

Browse files
authored
Merge pull request #344 from PxTools/fix/image-build
Added action publishing docker images to github [PXWEB2-350]
2 parents 3e516d5 + 81cd095 commit 10e2e94

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker build and publish
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log into registry ${{ env.REGISTRY }}
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
42+
- name: Build and push Docker image
43+
id: build-and-push
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
platforms: linux/amd64,linux/arm64
48+
push: true
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM node:20.18.0-slim AS build
22
WORKDIR /app
33
COPY . ./
4-
RUN npm ci
5-
RUN npx nx reset
6-
RUN npm run build
4+
RUN npm ci \
5+
&& npx nx reset \
6+
&& npm run build
77

88
# production environment
99
FROM nginxinc/nginx-unprivileged:1.27.2-alpine3.20

0 commit comments

Comments
 (0)