File tree 2 files changed +19
-6
lines changed
2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change
1
+ # syntax=docker/dockerfile:1.7-labs
1
2
FROM rust:1.77-buster
2
3
3
- COPY Cargo.toml /app/Cargo.toml
4
- COPY Cargo.lock /app/Cargo.lock
4
+ WORKDIR /app
5
5
6
- RUN mkdir /app/src
7
- RUN echo 'fn main() { println!("Hello World!"); }' > /app/src/main.rs
6
+ # .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
7
+ COPY --exclude=.git --exclude=README.md . /app
8
8
9
- WORKDIR /app
10
9
RUN cargo build --release --target-dir=/tmp/codecrafters-redis-target
11
10
12
11
RUN rm /tmp/codecrafters-redis-target/release/redis-starter-rust
13
12
RUN rm /tmp/codecrafters-redis-target/release/redis-starter-rust.d
14
13
14
+ # Build caching schenanigans, see if this can be simplified
15
15
RUN find /tmp/codecrafters-redis-target/release -type f -maxdepth 1 -delete
16
16
RUN rm -f /tmp/codecrafters-redis-target/release/deps/*redis_starter_rust*
17
17
RUN rm -f /tmp/codecrafters-redis-target/release/deps/redis_starter_rust*
@@ -25,3 +25,5 @@ RUN chmod +x /codecrafters-precompile.sh
25
25
26
26
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Cargo.toml,Cargo.lock"
27
27
28
+ # Once the heavy steps are done, we can copy all files back
29
+ COPY . /app
Original file line number Diff line number Diff line change 1
- FROM alpine:3.19
1
+ # syntax=docker/dockerfile:1.7-labs
2
+ FROM alpine:3.20
2
3
3
4
# Add the testing repository
4
5
RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
@@ -17,5 +18,15 @@ RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /et
17
18
# Update the package list and install Zig
18
19
RUN apk add --no-cache zig@community=0.12.0-r0
19
20
21
+ WORKDIR /app
22
+
23
+ # .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
24
+ COPY --exclude=.git --exclude=README.md . /app
25
+
26
+ RUN zig build
27
+
20
28
RUN printf "set -e \n cd \$ {CODECRAFTERS_SUBMISSION_DIR} \n echo 'Running zig build' \n zig build \n echo 'zig build completed.' \n " > /codecrafters-precompile.sh
21
29
RUN chmod +x /codecrafters-precompile.sh
30
+
31
+ # Once the heavy steps are done, we can copy all files back
32
+ COPY . /app
You can’t perform that action at this time.
0 commit comments