Skip to content

Commit

Permalink
ci: update docker workflow for zig build
Browse files Browse the repository at this point in the history
  • Loading branch information
ripperi committed Oct 2, 2024
1 parent aabf3d6 commit e5930d6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
60 changes: 28 additions & 32 deletions .github/workflows/docker-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -66,12 +56,18 @@ 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
file: ./docker/Dockerfile
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
file: ./docker/Dockerfile
tags: tloncorp/vere:latest
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e5930d6

Please sign in to comment.