Skip to content

Commit

Permalink
ci: split aarch64 and x86_64 dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Veirt committed Aug 5, 2024
1 parent 827cabb commit 6496970
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Docker Build

on:
push:
branches:
Expand All @@ -15,7 +14,7 @@ env:
IMAGE_NAME: veirt/vesta-test

jobs:
docker:
build:
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -47,14 +46,26 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push
- name: Build and push x86_64
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.x86_64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push aarch64
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.aarch64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
platforms: linux/arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
15 changes: 7 additions & 8 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ COPY gridPlugin.js tailwind.config.js ./
COPY src ./src
RUN bunx tailwindcss -i ./src/style.css -o ./out.css --minify

FROM --platform=$BUILDPLATFORM rust:1.80-alpine AS build
FROM --platform=$BUILDPLATFORM rust:1.80 AS build

RUN apk add --no-cache \
musl-dev \
build-base \
llvm \
clang
RUN apt-get update && apt-get install -y \
musl-tools \
gcc-aarch64-linux-gnu \
&& rm -rf /var/lib/apt/lists/*

RUN rustup target add aarch64-unknown-linux-musl

ENV CC_aarch64_unknown_linux_musl=clang \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=clang
ENV CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc

WORKDIR /usr/src
RUN USER=root cargo new --bin vesta
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile → Dockerfile.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ WORKDIR /temp
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile

COPY tailwind.config.js .
COPY gridPlugin.js tailwind.config.js ./
COPY src ./src
RUN bunx tailwindcss -i ./src/style.css -o ./out.css --minify

FROM rust:1.80-alpine AS build

RUN apk add musl-dev --no-cache
RUN apk add --no-cache musl-dev

WORKDIR /usr/src
RUN USER=root cargo new --bin vesta
Expand Down

0 comments on commit 6496970

Please sign in to comment.