diff --git a/.github/workflows/docker-image-arm.yml b/.github/workflows/docker-image-arm.yml new file mode 100644 index 0000000000..76c11ba789 --- /dev/null +++ b/.github/workflows/docker-image-arm.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c7146cdd7b..7385d7a2ac 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -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] @@ -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 @@ -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' @@ -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 }} diff --git a/Dockerfile b/Dockerfile index 26fd9a9b3a..3e5200037b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -59,13 +59,13 @@ 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 ./ @@ -73,7 +73,7 @@ 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 @@ -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 diff --git a/DockerfileHeavy b/docker/DockerfileHeavy similarity index 100% rename from DockerfileHeavy rename to docker/DockerfileHeavy