Skip to content

Commit

Permalink
fix dockerfile issue for zig
Browse files Browse the repository at this point in the history
  • Loading branch information
waghanza committed Jan 3, 2025
1 parent b3724a3 commit 9543b3b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions zig/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@ RUN useradd -m ziguser
# Install dependencies (update to latest secure versions)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
wget xz-utils \
ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Download the latest stable Zig binary from the official website
ARG ZIG_VERSION=0.13.0
RUN wget https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz
RUN wget https://ziglang.org/download/0.13.0/zig-linux-{{arch}}-0.13.0.tar.xz

RUN tar -xvf zig-linux-aarch64-0.13.0.tar.xz
RUN tar -xvf zig-linux-{{arch}}-0.13.0.tar.xz

RUN mv zig-linux-aarch64-0.13.0 /usr/local/zig && \
RUN mv zig-linux-{{arch}}-0.13.0 /usr/local/zig

# Add Zig to the PATH
ENV PATH="/usr/local/zig:$PATH"

# Switch to the non-root user
USER ziguser
WORKDIR /home/ziguser

{{#files}}
COPY '{{source}}' '{{target}}'
RUN chown ziguser {{target}}
{{/files}}
RUN chown -R ziguser src

# Switch to the non-root user
USER ziguser

RUN zig build -Doptimize=ReleaseFast

Expand Down

0 comments on commit 9543b3b

Please sign in to comment.