Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiled_starters/zig/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the Zig version used to run your code
# on Codecrafters.
#
# Available versions: zig-0.15
buildpack: zig-0.15
# Available versions: zig-0.15.2
buildpack: zig-0.15.2
30 changes: 30 additions & 0 deletions dockerfiles/zig-0.15.2.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# syntax=docker/dockerfile:1.7-labs
FROM debian:bookworm

RUN apt-get update && \
apt-get install --no-install-recommends -y xz-utils=5.4.1-1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Download and install Zig
RUN curl -O https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Curl Causes Build Failure

The Dockerfile uses curl to download the Zig tarball on line 10, but curl is not installed in the image. The apt-get install command on lines 4-5 only installs xz-utils, and the debian:bookworm base image does not include curl by default. This will cause the Docker build to fail with a "curl: command not found" error. The curl package needs to be added to the apt-get install command.

Fix in Cursor Fix in Web

&& tar -xf zig-x86_64-linux-0.15.2.tar.xz \
&& mv zig-x86_64-linux-0.15.2 /usr/local/zig \
&& rm zig-x86_64-linux-0.15.2.tar.xz

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

ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="build.zig,build.zig.zon"

WORKDIR /app

# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY --exclude=.git --exclude=README.md . /app

# This runs zig build
RUN .codecrafters/compile.sh

# Cache build directory
RUN mkdir -p /app-cached
RUN mv /app/.zig-cache /app-cached/.zig-cache || true
4 changes: 2 additions & 2 deletions solutions/zig/01-gg4/code/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the Zig version used to run your code
# on Codecrafters.
#
# Available versions: zig-0.15
buildpack: zig-0.15
# Available versions: zig-0.15.2
buildpack: zig-0.15.2
Loading