Skip to content

Commit

Permalink
build arm image (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohsimpson authored Jan 4, 2025
1 parent cb02b38 commit f031bd1
Show file tree
Hide file tree
Showing 5 changed files with 208 additions and 20 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
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Unit Tests

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run unit tests
run: bun test
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
166 changes: 166 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-toast": "^1.2.4",
"@types/bun": "^1.1.14",
"@types/canvas-confetti": "^1.9.0",
"@uiw/react-heat-map": "^2.3.2",
"canvas-confetti": "^1.9.3",
Expand Down Expand Up @@ -47,6 +46,7 @@
"@types/node": "^20.17.10",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/bun": "^1.1.14",
"eslint": "^9",
"eslint-config-next": "15.1.3",
"eslint-plugin-unused-imports": "^4.1.4",
Expand Down

0 comments on commit f031bd1

Please sign in to comment.