File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change 11FROM haskell:9.8.4-bullseye
22
3- WORKDIR /app
3+ # Ensures the container is re-built if go.mod or go.sum changes
4+ ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="stack.yaml,package.yaml,stack.yaml.lock"
45
56RUN mkdir -p /etc/stack
67
@@ -11,24 +12,17 @@ RUN echo "allow-different-user: true" >> /etc/stack/config.yaml
1112RUN echo "install-ghc: false" >> /etc/stack/config.yaml
1213RUN echo "system-ghc: true" >> /etc/stack/config.yaml
1314
14- COPY stack.yaml package.yaml stack.yaml.lock /app/
15+ WORKDIR /app
1516
16- # Dummy static content to circumvent the /app doesn't exist warning
17- RUN mkdir /app/app
18- RUN echo 'main :: IO ()' >> /app/app/Main.hs
19- RUN echo 'main = putStrLn "Hello, World!"' >> /app/app/Main.hs
17+ # .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
18+ COPY . /app/
19+ RUN rm -rf /app/.git /app/README.md
2020
2121ENV STACK_ROOT=/app/.stack
22-
2322RUN stack build
2423RUN stack clean codecrafters-http-server
24+
2525RUN mkdir /app-cached
2626RUN mv .stack-work /app-cached/.stack-work
2727RUN mv .stack /app-cached/.stack
28-
2928RUN rm -rf /app/app
30-
31- RUN echo "cd \$ {CODECRAFTERS_REPOSITORY_DIR} && stack build" > /codecrafters-precompile.sh
32- RUN chmod +x /codecrafters-precompile.sh
33-
34- ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="stack.yaml,package.yaml,stack.yaml.lock"
You can’t perform that action at this time.
0 commit comments