Каляшов Григорий :
I have a following structure:
[test]:
- Dockerfile
- [Test1.ear]
- [Test2.ear]
- ...
- [TestN.ear]
I'm trying copy all ear folders to "config/apps" folder:
COPY *.ear config/apps/
Structure in container which is expected:
[config/apps]:
- [Test1.ear]
- [Test2.ear]
- ...
- [TestN.ear]
But in "config/apps" folder copies only the contents (.war, .jar) of .ear folders.
How to use the COPY in this case?
atline :
Maybe you can use .dockerignore
to add only Test1.ear, Test2.ear, etc
to build context, then use COPY . config/apps
to meet your requirements:
.dockerignore:
*
!*.ear
Dockerfile:
FROM alpine
COPY . config/apps
Test:
cake@cake:~/1$ ls
abc Dockerfile Test1.ear Test2.ear
cake@cake:~/1$ docker build -t abc:1 .
Sending build context to Docker daemon 5.12kB
Step 1/2 : FROM alpine
---> b7b28af77ffe
Step 2/2 : COPY . config/apps
---> 4726a5828435
Successfully built 4726a5828435
Successfully tagged abc:1
cake@cake:~/1$ docker run --rm -it abc:1 ls /config/apps
Test1.ear Test2.ear