Issue
I'm trying to deploy a Java 11 app to EB with Docker container via CircleCI. How should the config files look like?
The build phase goes ok but the deployment phase stops to the point where the CircleCI won't find the Dockerfile and Dockerrun.aws.json files.
I've tried to zip the jar and the docker files after mvn package
but I'm not sure what I'm missing.
In .circleci/config.yml
jobs:
build:
docker:
- image: circleci/openjdk:11.0.2-jdk
.
.
.
- run:
name: Build artifacts
command: |
mvn package
zip Docker/myapp-0.1.0.zip target/myapp-0.1.0.jar Docker/Dockerfile Docker/Dockerrun.aws.json
.
.
.
deploy-to-dev:
docker:
- image: circleci/openjdk:11.0.2-jdk
.
.
.
- run:
name: Deploy to Dev
command: |
sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install awsebcli --upgrade
eb use myapp-env --profile circleci
eb deploy -v --profile circleci
In .elasticbeanstalk/config.yml
deploy:
artifact: Docker/myapp-0.1.0.zip
Right now the CircleCI gives the following error
2019-10-21 07:27:00 INFO Environment update is starting.
2019-10-21 07:27:04 INFO Deploying new version to instance(s).2019-10-21 07:27:10 ERROR Dockerfile and Dockerrun.aws.json are both missing, abort deployment
Solution
Turned out that I just needed to add -j
to the zipping command.
zip -j Docker/myapp-0.1.0.zip target/myapp-0.1.0.jar Docker/Dockerfile Docker/Dockerrun.aws.json
Now the files are found and the app gets deployed.
Answered By - Sp3ci
Answer Checked By - Clifford M. (JavaFixing Volunteer)