-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CC-1333 Add repository aware caching
- Loading branch information
1 parent
e8014c5
commit e4d4bda
Showing
20 changed files
with
120 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim | ||
|
||
COPY codecrafters-sqlite.csproj /app/codecrafters-sqlite.csproj | ||
COPY codecrafters-sqlite.sln /app/codecrafters-sqlite.sln | ||
|
||
RUN mkdir /app/src | ||
RUN (echo 'System.Console.WriteLine("If you are seeing this, there is something wrong with our caching mechanism! Please contact us at [email protected].");' > /app/src/Program.cs) > /dev/null | ||
|
||
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 saves nuget packages to ~/.nuget | ||
RUN dotnet build --configuration Release . | ||
|
@@ -22,3 +23,6 @@ RUN chmod +x /codecrafters-precompile.sh | |
|
||
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="codecrafters-sqlite.csproj,codecrafters-sqlite.sln" | ||
|
||
|
||
# Once the heave steps are done, we can copy all files back | ||
COPY . /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine | ||
|
||
COPY codecrafters-sqlite.csproj /app/codecrafters-sqlite.csproj | ||
COPY codecrafters-sqlite.sln /app/codecrafters-sqlite.sln | ||
|
||
RUN mkdir /app/src | ||
RUN (echo 'System.Console.WriteLine("If you are seeing this, there is something wrong with our caching mechanism! Please contact us at [email protected].");' > /app/src/Program.cs) > /dev/null | ||
|
||
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 saves nuget packages to ~/.nuget | ||
RUN dotnet build --configuration Release . | ||
|
@@ -22,3 +23,6 @@ RUN chmod +x /codecrafters-precompile.sh | |
|
||
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="codecrafters-sqlite.csproj,codecrafters-sqlite.sln" | ||
|
||
|
||
# Once the heave steps are done, we can copy all files back | ||
COPY . /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM node:21.7-alpine3.19 | ||
|
||
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="package.json,package-lock.json" | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses | ||
COPY --exclude=.git --exclude=README.md . /app | ||
|
||
# If dependencies in the package lock do not match those in package.json, instead of updating the package lock, npm ci will exit with an error. | ||
RUN npm ci | ||
|
||
RUN mkdir -p /app-cached | ||
# If the node_modules directory exists, move it to /app-cached | ||
RUN if [ -d "/app/node_modules" ]; then mv /app/node_modules /app-cached; fi | ||
|
||
# Once the heave steps are done, we can copy all files back | ||
COPY . /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM ruby:3.3-alpine | ||
|
||
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Gemfile,Gemfile.lock" | ||
|
||
WORKDIR /app | ||
|
||
COPY Gemfile Gemfile.lock ./ | ||
# .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 bundle install --verbose | ||
|
||
# Once the heave steps are done, we can copy all files back | ||
COPY . /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.