Skip to content

Commit 860c136

Browse files
authored
Merge pull request #53 from TBosak/main
Adding arm64 support
2 parents f524b2c + 8438f90 commit 860c136

File tree

2 files changed

+74
-26
lines changed

2 files changed

+74
-26
lines changed

.github/workflows/docker-deploy.yml

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Build and Push Docker Images
33
on:
44
push:
55
branches: [deploy]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version tag (leave empty to use package.json version and tag as latest)"
10+
required: false
11+
type: string
612

713
jobs:
814
build-and-push:
@@ -13,40 +19,63 @@ jobs:
1319

1420
steps:
1521
- name: Checkout repository
16-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v3
26+
with:
27+
platforms: arm64
1728

1829
- name: Set up Docker Buildx
19-
uses: docker/setup-buildx-action@v2
30+
uses: docker/setup-buildx-action@v3
2031

21-
# Login to Docker Hub
2232
- name: Log in to Docker Hub
23-
uses: docker/login-action@v2
33+
uses: docker/login-action@v3
2434
with:
2535
registry: docker.io
2636
username: ${{ secrets.DOCKERHUB_USERNAME }}
2737
password: ${{ secrets.DOCKERHUB_TOKEN }}
2838

29-
# Login to GitHub Container Registry
3039
- name: Log in to GitHub Container Registry
31-
uses: docker/login-action@v2
40+
uses: docker/login-action@v3
3241
with:
3342
registry: ghcr.io
3443
username: ${{ github.actor }}
3544
password: ${{ secrets.GHCR_TOKEN }}
3645

37-
- name: Extract version from package.json
46+
- name: Determine version and tags
3847
id: vars
3948
run: |
40-
VERSION=$(node -p "require('./package.json').version")
49+
if [ -n "${{ inputs.version }}" ]; then
50+
VERSION="${{ inputs.version }}"
51+
USE_LATEST="false"
52+
else
53+
VERSION=$(node -p "require('./package.json').version")
54+
USE_LATEST="true"
55+
fi
56+
57+
TAGS="docker.io/tbosk/mkfd:${VERSION}"$'\n'"ghcr.io/tbosak/mkfd:${VERSION}"
58+
if [ "${USE_LATEST}" = "true" ]; then
59+
TAGS="$TAGS"$'\n'"docker.io/tbosk/mkfd:latest"$'\n'"ghcr.io/tbosak/mkfd:latest"
60+
fi
61+
4162
echo "VERSION=$VERSION" >> $GITHUB_ENV
63+
echo "USE_LATEST=$USE_LATEST" >> $GITHUB_ENV
64+
echo "TAGS<<EOF" >> $GITHUB_ENV
65+
echo "$TAGS" >> $GITHUB_ENV
66+
echo "EOF" >> $GITHUB_ENV
67+
68+
echo "Building version: $VERSION (latest tag: $USE_LATEST)"
69+
echo "Docker tags:"
70+
echo "$TAGS"
4271
43-
- name: Build and push Docker images to Docker Hub and GHCR
44-
uses: docker/build-push-action@v4
72+
- name: Build and push multi-arch images to Docker Hub and GHCR
73+
uses: docker/build-push-action@v6
4574
with:
4675
context: .
4776
push: true
48-
tags: |
49-
docker.io/tbosk/mkfd:latest
50-
docker.io/tbosk/mkfd:${{ env.VERSION }}
51-
ghcr.io/tbosak/mkfd:latest
52-
ghcr.io/tbosak/mkfd:${{ env.VERSION }}
77+
platforms: linux/amd64,linux/arm64
78+
tags: ${{ env.TAGS }}
79+
provenance: true
80+
network: host
81+
allow: network.host

dockerfile

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
11
FROM oven/bun:1.2.2-debian
2+
ARG NODE_MAJOR=22
3+
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
24

3-
RUN apt-get update && apt-get install -y \
4-
curl \
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
ca-certificates curl gnupg \
57
&& rm -rf /var/lib/apt/lists/*
68

7-
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash - \
8-
&& apt-get install -y nodejs
9+
RUN printf 'Acquire::Retries "5";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' \
10+
> /etc/apt/apt.conf.d/80-retries
911

10-
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
11-
RUN bunx patchright install --with-deps chromium
12+
RUN if [ -f /etc/apt/sources.list ]; then \
13+
sed -i 's|http://deb.debian.org|https://deb.debian.org|g; s|http://security.debian.org|https://security.debian.org|g' /etc/apt/sources.list; \
14+
fi && \
15+
if [ -f /etc/apt/sources.list.d/debian.sources ]; then \
16+
sed -i 's|http://deb.debian.org|https://deb.debian.org|g; s|http://security.debian.org|https://security.debian.org|g' /etc/apt/sources.list.d/debian.sources; \
17+
fi
18+
19+
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - \
20+
&& apt-get update \
21+
&& apt-get install -y --no-install-recommends nodejs \
22+
&& rm -rf /var/lib/apt/lists/*
1223

1324
WORKDIR /app
1425

15-
COPY package.json bun.lock ./
26+
COPY package.json bun.lock* ./
1627
RUN bun install
1728

29+
RUN set -eux; \
30+
ok=0; \
31+
for i in 1 2 3 4 5; do \
32+
if bunx patchright install --with-deps chromium; then ok=1; break; fi; \
33+
echo "patchright install failed (attempt $i), retrying..."; \
34+
sleep $((i * 5)); \
35+
done; \
36+
[ "$ok" -eq 1 ]
37+
1838
COPY . .
1939

20-
# Create directories for volumes
21-
RUN mkdir -p /app/configs /app/extensions && \
22-
chmod -R 755 /app/configs /app/extensions
40+
RUN mkdir -p /app/configs /app/extensions \
41+
&& chmod -R 755 /app/configs /app/extensions
2342

2443
EXPOSE 5000
2544

@@ -28,4 +47,4 @@ VOLUME ["/app/configs", "/app/extensions"]
2847
HEALTHCHECK --interval=5m --timeout=10s --start-period=1m --retries=3 \
2948
CMD curl -f http://localhost:5000/ || exit 1
3049

31-
CMD ["bun", "run", "index.ts"]
50+
CMD ["bun", "run", "index.ts"]

0 commit comments

Comments
 (0)