Skip to content

Commit

Permalink
Fix arm/v7 build hang problem
Browse files Browse the repository at this point in the history
  • Loading branch information
lowercasename committed Jul 31, 2024
1 parent 162d8c1 commit 15d4c90
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/publish-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ jobs:
- name: Publish to GHCR
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:${{ steps.package-version.outputs.current-version }}
ghcr.io/${{ github.repository }}:latest
# - name: Publish to GHCR
# run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# - run: docker build -t ghcr.io/${{ github.repository }}:latest .
# - run: docker push ghcr.io/${{ github.repository }}:latest
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:20-alpine
# Docker builds hang in arm/v7 images, so we use Node 18 to build and Node 20 to run
# Cf. https://github.com/docker/build-push-action/issues/1071
FROM node:18-alpine AS BUILD_IMAGE
WORKDIR /app
RUN apk add --no-cache python3 build-base
ADD package.json pnpm-lock.yaml /app/
Expand All @@ -8,5 +10,10 @@ COPY . /app/
# Always exit 0 here because TSC will fail while we're migrating to TypeScript but
# not everything uses TypeScript
RUN pnpm run build; exit 0

# Now we run the app
FROM node:20-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY --from=BUILD_IMAGE /app/dist /app/dist
CMD ["node", "dist/start.js"]

0 comments on commit 15d4c90

Please sign in to comment.