Skip to content

Commit

Permalink
build: support for zig dev builds
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
  • Loading branch information
berezovskyi committed Jul 16, 2023
1 parent 592e7a8 commit cfa50d5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Dockerfile.logger
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM alpine:3.13 as builder
ARG ZIGVER=0.10.1
ARG ZIGDEV=false

RUN apk update && \
apk add \
Expand All @@ -8,9 +9,12 @@ RUN apk update && \

RUN mkdir -p /opt
WORKDIR /opt
RUN curl https://ziglang.org/download/${ZIGVER}/zig-linux-x86_64-${ZIGVER}.tar.xz -O && \
RUN { ! ${ZIGDEV} && curl https://ziglang.org/download/${ZIGVER}/zig-linux-x86_64-${ZIGVER}.tar.xz -O && \
tar xf zig-linux-x86_64-${ZIGVER}.tar.xz && \
mv zig-linux-x86_64-${ZIGVER}/ zig/
mv zig-linux-x86_64-${ZIGVER}/ zig/ ; } || true
RUN { ${ZIGDEV} && curl https://ziglang.org/builds/zig-linux-x86_64-${ZIGVER}.tar.xz -O && \
tar xf zig-linux-x86_64-${ZIGVER}.tar.xz && \
mv zig-linux-x86_64-${ZIGVER}/ zig/ ; } || true

COPY . /app
WORKDIR /app
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile.publisher
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM alpine:3.13 as builder
ARG ZIGVER=0.10.1
ARG ZIGDEV=false

RUN apk update && \
apk add \
Expand All @@ -8,9 +9,12 @@ RUN apk update && \

RUN mkdir -p /opt
WORKDIR /opt
RUN curl https://ziglang.org/download/${ZIGVER}/zig-linux-x86_64-${ZIGVER}.tar.xz -O && \
RUN { ! ${ZIGDEV} && curl https://ziglang.org/download/${ZIGVER}/zig-linux-x86_64-${ZIGVER}.tar.xz -O && \
tar xf zig-linux-x86_64-${ZIGVER}.tar.xz && \
mv zig-linux-x86_64-${ZIGVER}/ zig/
mv zig-linux-x86_64-${ZIGVER}/ zig/ ; } || true
RUN { ${ZIGDEV} && curl https://ziglang.org/builds/zig-linux-x86_64-${ZIGVER}.tar.xz -O && \
tar xf zig-linux-x86_64-${ZIGVER}.tar.xz && \
mv zig-linux-x86_64-${ZIGVER}/ zig/ ; } || true

COPY . /app
WORKDIR /app
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
```sh
cp docker-compose.yml.sample docker-compose.yml
mkdir data/
(cd data/ && git clone git@github.com:berezovskyi/zig-irc-logs.git repo)
(cd data/ && git clone git@github.com:berezovskyi/zig-irc-logs.git repo && cd repo && git checkout live)
ssh-keygen -f secrets/id_ed25519 -t ed25519
zig build -Dtarget=x86_64-linux && docker-compose up
ssh-keyscan -t ed25519 github.com > secrets/known_hosts
# for debug builds on macOS
# zig build -Dtarget=x86_64-linux
docker-compose up --build
# make the .ssh volume :ro
docker-compose up -d --build
```
5 changes: 5 additions & 0 deletions docker-compose.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
version: '2.4'

x-ZIGVER: &ZIGVER 'ZIGVER=0.10.1'
x-ZIGDEV: &ZIGDEV 'ZIGDEV=false'
# x-ZIGVER: &ZIGVER 'ZIGVER=0.11.0-dev.4003+c6aa29b6f'
# x-ZIGDEV: &ZIGDEV 'ZIGDEV=true'

services:
# 1) Avoid bespoke tags
Expand All @@ -12,6 +15,7 @@ services:
dockerfile: Dockerfile.logger
args:
- *ZIGVER
- *ZIGDEV
# unless-stopped is not what you think it is
restart: always
environment:
Expand All @@ -34,6 +38,7 @@ services:
- 'GIT_USER=John Doe'
- 'GIT_EMAIL=john@example.com'
- *ZIGVER
- *ZIGDEV
restart: always
# environment:
# - ZIGIRC_LOGS=/logs
Expand Down

0 comments on commit cfa50d5

Please sign in to comment.