You will need about one minute to read this article.
Because CodeShip Pro only caches image layers of the final Dockerfile stage, artifacts copied into the final stage may continually invalidate subsequent cache layers.
In our contrived Dockerfile, we have a multi-stage build:
# Dockerfile FROM ubuntu:xenial as stage-one COPY ./artifact-materials . RUN ./make-artifact.sh FROM ubuntu:xenial as app COPY --from stage-one ./artifact.sh ./artifact.sh RUN ./time-consuming-build-process.sh COPY . .
Our recommendation would be to split the stages into separate services:
# Dockerfile.stage-one FROM ubuntu:xenial COPY ./artifact-materials . RUN ./make-artifact.sh
# Dockerfile.app FROM stage-one as stage-one FROM ubuntu:xenial COPY --from stage-one ./artifact.sh ./artifact.sh RUN ./time-consuming-build-process.sh COPY . .
# codeship-services.yml stage-one: build: dockerfile: Dockerfile.stage-one cached: true app: build: dockerfile: Dockerfile.app cached: true
# codeship-steps.yml - name: build stage-one before triggering a build on app image/service service: stage-one command: true - service: app command: ./run-tests.sh
Contact our support team or post on Stack Overflow using the tag
#codeship. Did you check the status page and changelog?
There are also several code examples and sample projects available for you to get started with.