From a7043c0f213d11d1eca50204215019f750c24b4e Mon Sep 17 00:00:00 2001 From: Santeri Hannula Date: Wed, 2 Oct 2024 15:42:11 +0300 Subject: [PATCH] ci: update docker build job for zig build --- .github/workflows/docker-shared.yml | 58 +++++++++++++---------------- docker/Dockerfile | 9 +++++ 2 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 docker/Dockerfile diff --git a/.github/workflows/docker-shared.yml b/.github/workflows/docker-shared.yml index 7e73ae0729..7edd09c1d8 100644 --- a/.github/workflows/docker-shared.yml +++ b/.github/workflows/docker-shared.yml @@ -16,36 +16,26 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: mlugg/setup-zig@v1 + with: + version: 0.13.0 + # - # BUILD OR READ FROM CACHE + # BUILD # - - name: chown /usr/local + - name: Build binary + id: build run: | - # See https://github.com/actions/cache/issues/845. - sudo chown $(whoami) /usr/local && (chown -R $USER /usr/local/*-musl || true) + zig build \ + -Dtarget=x86_64-linux-musl \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} \ + --summary all - - name: Set up build cache - id: build-cache - uses: actions/cache@v3 - with: - key: linux-x86_64-cache - path: | - # # Cache bazel path on Linux. - ~/.cache/bazel/_bazel_$(whoami) - # Cache musl libc toolchains. - /usr/local/*-musl - - - name: Install toolchains - if: steps.build-cache.outputs.cache-hit != 'true' - run: | - bazel run //bazel/toolchain:x86_64-linux-musl-gcc + cp zig-out/x86_64-linux-musl/urbit docker/. - - name: Install dependencies - run: sudo apt-get install -y autoconf-archive - - - name: Set pace - run: echo "${{ inputs.pace }}" > ./PACE + echo version=v$(sed -nr 's/#define URBIT_VERSION "(.*)"/\1/p' zig-out/include/version.h) >> $GITHUB_OUTPUT # # UPLOAD TO DOCKER @@ -66,12 +56,16 @@ jobs: short_description: 'Urbit: a clean-slate OS and network for the 21st century' readme_file: 'docker/README.md' - - name: Build and push version-tagged Docker image - run: bazel run //docker:push_version_x86_64 - - - name: Build and push pace-tagged Docker image - run: bazel run //docker:push_pace_x86_64 + - name: Build and push + if: ${{ inputs.pace != 'live' }} + uses: docker/build-push-action@v6 + with: + push: true + tags: tloncorp/vere:${{ steps.build.outputs.version }},tloncorp/vere:${{ inputs.pace }} - - name: Build and push latest-tagged Docker image - if: ${{ inputs.pace == 'live' }} - run: bazel run //docker:push_latest_x86_64 + - name: Build and push live + if: ${{ inputs.pace = 'live' }} + uses: docker/build-push-action@v6 + with: + push: true + tags: tloncorp/vere:latest diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..fcefb4a4a7 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:3.17.1 +RUN apk update && apk add bash curl +ENV PATH="$PATH:/bin" +COPY get_urbit_code.sh reset_urbit_code.sh start_urbit.sh urbit /bin/ +EXPOSE 80/tcp +EXPOSE 34343/udp +VOLUME /urbit +WORKDIR /urbit +CMD start-urbit