Skip to content

Commit 037b7ef

Browse files
authored
Enable Multiplatform build and Change image name to lower-xase (#3)
* change lower case * dev * test * dev * use shell for lower case * remove multiple platform * enable multiple platform * dev * test * test * make docker size smaller * Final fix
1 parent 0bd67d1 commit 037b7ef

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.github/workflows/docker-publish.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,30 @@ jobs:
4444
- name: Checkout repository
4545
uses: actions/checkout@v4
4646

47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v3
49+
# 👆 This is needed ARM emulation on AMD64 runner
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
# 👆 This is need for QEMU to work
54+
4755
- name: Log in to GitHub Container Registry
4856
uses: docker/login-action@v3
4957
with:
5058
registry: ghcr.io
5159
username: ${{ github.actor }}
5260
password: ${{ secrets.GITHUB_TOKEN }}
5361

62+
- name: Set lowercase repository name
63+
run: |
64+
echo "LOWERCASE_REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
65+
5466
- name: Extract metadata for Docker
5567
id: meta
5668
uses: docker/metadata-action@v5
5769
with:
58-
images: ghcr.io/${{ github.repository }}
70+
images: ghcr.io/${{ env.LOWERCASE_REPO }}
5971

6072
- name: Build and push
6173
uses: docker/build-push-action@v6
@@ -65,6 +77,6 @@ jobs:
6577
file: ./docker/Dockerfile
6678
push: true
6779
tags: |
68-
ghcr.io/${{ github.repository }}:latest
69-
ghcr.io/${{ github.repository }}:${{ github.sha }}
80+
ghcr.io/${{ env.LOWERCASE_REPO }}:latest
81+
ghcr.io/${{ env.LOWERCASE_REPO }}:${{ github.sha }}
7082
labels: ${{ steps.meta.outputs.labels }}

docker/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Using 18 alpine because supports arm/v8 and arm/v8 needed for silicon chips
2-
FROM node:18-alpine
3-
RUN apk add --no-cache bash
2+
3+
# Builder stage with build tools - especially for node-gyp in arm64
4+
FROM node:18-alpine AS builder
5+
RUN apk add --no-cache bash python3 make g++
46
WORKDIR /app
57
ADD ./ .
68
RUN npm install
79
RUN npm run build
10+
11+
# Runtime stage - minimal
12+
FROM node:18-alpine
13+
RUN apk add --no-cache bash
14+
WORKDIR /app
15+
ADD ./ .
16+
COPY --from=builder /app/node_modules /app/node_modules
817
CMD ["npm", "start"]

0 commit comments

Comments
 (0)