Skip to content

Commit

Permalink
feat: publish arm64 image (windmill-labs#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel authored Nov 10, 2022
1 parent 79b5a31 commit c3b2bab
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 8 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/docker-image-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
LOCAL_REGISTRY: registry.wimill.xyz

name: Build and push arm docker image
on:
push:
branches: [main]
tags: ["*"]

concurrency:
group: ${{ github.ref }}-arm
cancel-in-progress: true

jobs:
publish_arm:
runs-on: [self-hosted, new]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta-slim-public
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push publicly
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/arm64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ steps.meta-slim-public.outputs.tags }}
labels: |
${{ steps.meta-slim-public.outputs.labels }}
org.opencontainers.image.licenses=AGPLv3
cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-arm:buildcache
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-arm:buildcache
8 changes: 5 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ jobs:
cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:buildcache



playwright:
runs-on: [self-hosted, new]
needs: [build]
Expand All @@ -116,6 +115,9 @@ jobs:
- name: "Docker"
run: echo "::set-output name=id::$(docker run --network=host --rm -d -p 8000:8000 --privileged -it -e DATABASE_URL=postgres://admin:changeme@localhost:5432/windmill -e BASE_INTERNAL_URL=http://localhost:8000 ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-slim:latest)"
id: docker-container
- uses: actions/setup-node@v3
with:
node-version: 16
- name: "Playwright run"
timeout-minutes: 2
run: cd frontend && npm ci @playwright/test && npx playwright install && npm run test
Expand Down Expand Up @@ -146,7 +148,7 @@ jobs:
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login to ECR
if: github.event_name != 'pull_request'
Expand All @@ -162,7 +164,7 @@ jobs:
with:
context: .
push: true
file: ./DockerfileHeavy
file: ./docker/DockerfileHeavy
tags: |
${{ steps.meta-heavy.outputs.tags }}
labels: ${{ steps.meta-heavy.outputs.labels }}
Expand Down
25 changes: 20 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN apt-get -y update \

RUN rustup component add rustfmt

RUN cargo install cargo-chef
RUN CARGO_NET_GIT_FETCH_WITH_CLI=true cargo install cargo-chef

WORKDIR /windmill

Expand Down Expand Up @@ -59,21 +59,21 @@ FROM rust_base AS planner
COPY ./openflow.openapi.yaml /openflow.openapi.yaml
COPY ./backend ./

RUN cargo chef prepare --recipe-path recipe.json
RUN CARGO_NET_GIT_FETCH_WITH_CLI=true cargo chef prepare --recipe-path recipe.json

FROM rust_base AS builder

COPY --from=planner /windmill/recipe.json recipe.json

RUN cargo chef cook --release --recipe-path recipe.json
RUN CARGO_NET_GIT_FETCH_WITH_CLI=true cargo chef cook --release --recipe-path recipe.json

COPY ./openflow.openapi.yaml /openflow.openapi.yaml
COPY ./backend ./

COPY --from=frontend /frontend /frontend
COPY .git/ .git/

RUN cargo build --release
RUN CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --release


FROM python:3.11.0-slim-buster
Expand All @@ -84,7 +84,22 @@ RUN apt-get update \
&& apt-get install -y ca-certificates wget curl git jq libprotobuf-dev libnl-route-3-dev \
&& rm -rf /var/lib/apt/lists/*

RUN wget https://golang.org/dl/go1.19.1.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz && rm go1.19.1.linux-amd64.tar.gz
RUN set -eux; \
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \
url=; \
case "$arch" in \
'amd64') \
targz='go1.19.3.linux-amd64.tar.gz'; \
sha256='74b9640724fd4e6bb0ed2a1bc44ae813a03f1e72a4c76253e2d5c015494430ba'; \
;; \
'arm64') \
targz='go1.19.3.linux-arm64.tar.gz'; \
sha256='99de2fe112a52ab748fb175edea64b313a0c8d51d6157dba683a6be163fd5eab'; \
;; \
*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
esac; \
wget "https://golang.org/dl/$targz" && tar -C /usr/local -xzf "$targz" && rm "$targz";

ENV PATH="${PATH}:/usr/local/go/bin"
ENV GO_PATH=/usr/local/go/bin/go

Expand Down
File renamed without changes.

0 comments on commit c3b2bab

Please sign in to comment.