-
-
Save AlexRogalskiy/b18611c0530b2503e22784aeb6a9b426 to your computer and use it in GitHub Desktop.
Dockerfile demonstrating multi-stage build
This file contains hidden or 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
FROM mysql:5 as sqldump | |
WORKDIR /home | |
# Copy required artifacts and source code | |
COPY initial.sql . | |
COPY java-program ./java-program | |
COPY sqldump.sh . | |
# Copy jdk11 and gradle from the gradle:jdk11 image | |
COPY --from=gradle:jdk11 /opt/java /opt/java | |
COPY --from=gradle:jdk11 /opt/gradle /opt/gradle | |
# Set environment variable | |
ARG MYSQL_ROOT_PASSWORD=root | |
# Execute the build script which will generate the sql dump | |
RUN chmod u+x sqldump.sh && /bin/bash -c ./sqldump.sh | |
FROM mysql:5 | |
COPY --from=sqldump /home/dump.sql.gz /docker-entrypoint-initdb.d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment