Merge pull request #4 from codecrafters-io/sync

Sync with languages repo
This commit is contained in:
Paul Kuruvilla 2021-09-23 20:35:32 +01:00 committed by GitHub
commit a4b7d6b2f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -1,4 +1,4 @@
FROM rust:1.43-buster
FROM rust:1.54-buster
# Download docker-explorer
ARG docker_explorer_version=v18
@ -6,14 +6,17 @@ RUN curl --fail -Lo /usr/local/bin/docker-explorer https://github.com/codecrafte
RUN chmod +x /usr/local/bin/docker-explorer
# Grab the dependencies and compile them as they dont change much
WORKDIR /app
COPY Cargo.toml /app/Cargo.toml
COPY Cargo.lock /app/Cargo.lock
RUN mkdir src && echo "fn main() {}" > "src/main.rs"
RUN cargo build --release
RUN mkdir /app/src
RUN echo 'fn main() { println!("Hello World!"); }' > /app/src/main.rs
WORKDIR /app
RUN cargo build --release --target-dir=/tmp/codecrafters-docker-target
RUN cargo clean -p docker-starter-rust --release --target-dir=/tmp/codecrafters-docker-target
# Grab the real code
ADD . /app
WORKDIR /app
ENTRYPOINT ["/app/your_docker.sh"]

View File

@ -43,6 +43,9 @@ You can then execute your program like this:
mydocker run ubuntu:latest /usr/local/bin/docker-explorer echo hey
```
This command compiles your Rust project, so it might be slow the first time you
run it. Subsequent runs will be fast.
# Passing the first stage
CodeCrafters runs tests when you do a `git push`. Make an empty commit and push