Skip to content

Commit

Permalink
build arm image
Browse files Browse the repository at this point in the history
  • Loading branch information
dohsimpson committed Jan 4, 2025
1 parent cb02b38 commit 67734c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
# - github-actions
- github-actions

jobs:
build-and-push:
Expand Down Expand Up @@ -40,22 +40,19 @@ jobs:
echo "EXISTS=false" >> $GITHUB_OUTPUT
fi
- name: Build Docker image
run: docker build -t habittrove .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push Docker images
run: |
if [ "${{ steps.check-version.outputs.EXISTS }}" = "false" ]; then
docker tag habittrove dohsimpson/habittrove:v${{ steps.package-version.outputs.VERSION }}
docker push dohsimpson/habittrove:v${{ steps.package-version.outputs.VERSION }}
echo "Pushed tag: v${{ steps.package-version.outputs.VERSION }}"
docker tag habittrove dohsimpson/habittrove:latest
docker push dohsimpson/habittrove:latest
echo "Pushed tag: latest"
fi
docker tag habittrove dohsimpson/habittrove:dev
docker push dohsimpson/habittrove:dev
echo "Pushed tag: dev"
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.check-version.outputs.EXISTS == 'false' && format('dohsimpson/habittrove:v{0}', steps.package-version.outputs.VERSION) || '' }}
${{ steps.check-version.outputs.EXISTS == 'false' && 'dohsimpson/habittrove:latest' || '' }}
dohsimpson/habittrove:dev
deploy-demo:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker.io/docker/dockerfile:1

FROM node:18-alpine AS base
FROM --platform=$BUILDPLATFORM node:18-alpine AS base

# Install dependencies only when needed
FROM base AS deps
FROM --platform=$BUILDPLATFORM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
Expand All @@ -19,7 +19,7 @@ RUN \
fi

# Rebuild the source code only when needed
FROM base AS builder
FROM --platform=$BUILDPLATFORM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
Expand Down

0 comments on commit 67734c0

Please sign in to comment.