I want to build a docker image that is based on dockerage/apache-mellon which has a volume on /var/www
. I want to build my web app inside the docker container when I'm building it inside a temporary directory and than copy the files to /var/www
with the following commands in my Dockerfile:
WORKDIR /tmp
COPY . /tmp
RUN ./node_modules/gulp/bin/gulp.js
RUN cp -R /tmp/dist/ /var/www
The docker build process finishes without any errors, but the files do not get copied to /var/www
.
Is there a way to copy files to a location which is declared as docker volume during build?
You can't do it during the build. The volume is something that interacts with containers, not images. You could create an entrypoint script that copies the files to the volume when the container is launched, but i'm not sure that this would be a good solution
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With