How to remove the numbers inside the source file name in COPY command in Dockerfile?

Viewed 38

I was writing a docker file to copy some war files in the webapps folder of tomcat container. The war files are contained inside target folder after maven build.

ARG BUILD_VERSION=1.0
COPY STUDENT_MANAGER/target/STUDENT-${BUILD_VERSION}/*.war /opt/tomcat/webapps

How can I remove the build version and write something like

COPY STUDENT_MANAGER/target/STUDENT*/*.war /opt/tomcat/webapps

I want to remove the build number as I want to automate the docker build and copy the files irrespective of build version.

1 Answers

i'd suggest you put your *.war in one repository war-repo then run:

COPY war-repo /opt/tomcat/webapps/

which will copy all *.war files

or you'll need to enter your files one by one, from docs https://docs.docker.com/engine/reference/builder/#copy

COPY path1/*1.war path2/*2.war ... /opt/tomcat/webapps
Related