The image felixmulder/dotty:0.1 has the following Dockerfile:
# Add git to image
RUN apk add --update git
# Clone the modified standard library for testing, then copy it via the .drone.yml file
RUN git clone -b dotty-library https://github.com/DarkDimius/scala.git scala-scala
# Add ivy2 cache
COPY ivy2/ ivy2
When running and attaching to the dotty image on my machine I can see the directories ivy2 and scala-scala in /drone. But the commands in the .drone.yml file fail because there is nothing (except src) in /drone when the CI is running.
I’m sure I’m missing something obvious as I’m fairly new to both docker and drone.
The problem is that /drone is a reserved path, by default, for every build. It is the path at which your build workspace (where your code is cloned) is mounted as a volume.
Let’s say we have the following Yaml file:
- go build
- go test
The build container is started with a shared volume mounted at /drone. You can think of it like drone running the following docker commands:
docker volume add drone-volume-for-build
docker run --volume=drone-volume-for-buid:/drone golang:latest
The volume mounted at /drone is therefore mounted on top of the /drone directory you created in your dockerfile, which is why it isn’t visible during the build. This can be resolved by using a different cache path in your Dockerfile: