Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC-1333 Add repository aware caching #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion dockerfiles/go-1.19.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# syntax=docker/dockerfile:1.7-labs
FROM golang:1.19-alpine

ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="go.mod,go.sum"

WORKDIR /app

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

RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs -r go get

Check failure on line 11 in dockerfiles/go-1.19.Dockerfile

View workflow job for this annotation

GitHub Actions / test_course_definition / docker_lint

DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check


# Once the heave steps are done, we can copy all files back
COPY . /app
9 changes: 6 additions & 3 deletions dockerfiles/python-3.11.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# syntax=docker/dockerfile:1.7-labs
FROM python:3.11-alpine

RUN pip install pipenv

Check failure on line 4 in dockerfiles/python-3.11.Dockerfile

View workflow job for this annotation

GitHub Actions / test_course_definition / docker_lint

DL3013 warning: Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>`

Check failure on line 4 in dockerfiles/python-3.11.Dockerfile

View workflow job for this annotation

GitHub Actions / test_course_definition / docker_lint

DL3042 warning: Avoid use of cache directory with pip. Use `pip install --no-cache-dir <package>`

COPY Pipfile /app/Pipfile
COPY Pipfile.lock /app/Pipfile.lock

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

ENV WORKON_HOME=/venvs

Expand All @@ -14,4 +15,6 @@
# Force environment creation
RUN pipenv run python3 -c "1+1"

ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Pipfile,Pipfile.lock"
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Pipfile,Pipfile.lock"
# Once the heave steps are done, we can copy all files back
COPY . /app
8 changes: 6 additions & 2 deletions dockerfiles/rust-1.70.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# syntax=docker/dockerfile:1.7-labs
FROM rust:1.70-buster

COPY Cargo.toml /app/Cargo.toml
COPY Cargo.lock /app/Cargo.lock

RUN mkdir /app/src
RUN echo 'fn main() { println!("Hello World!"); }' > /app/src/main.rs

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
RUN cargo build --release --target-dir=/tmp/codecrafters-grep-target

RUN cargo clean -p grep-starter-rust --release --target-dir=/tmp/codecrafters-grep-target
Expand All @@ -18,3 +19,6 @@ RUN chmod +x /codecrafters-precompile.sh

ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Cargo.toml,Cargo.lock"


# Once the heave steps are done, we can copy all files back
COPY . /app
Loading