Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to transfer my built app (.war) into docker image

Matt April 26, 2019

I'm using this tutorial as a basis:

https://confluence.atlassian.com/bitbucket/deploy-to-amazon-ecs-892623902.html

but I can't get my head around the step that moves the built app into the docker images (which we then push to docker hub)

Is it in the docker file,

# Bundle app source
COPY . /usr/src/app

or in the bitbucket-pipelines.yml?

          # build and test the Node app
          - npm install
          - npm test

My guess is in the docker file.... in which case, does the  'dot' signify the root directory of the repository that the pipeline is acting upon and the /usr/src/app relate to the filesystem of the target docker image?

 

Many thanks

Matt

1 answer

0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2019

Hello Matt,

The step that moves the built app into the Docker image is the one in the Dockerfile.

# Bundle app source
COPY . /usr/src/app

The NPM install and NPM test steps are used if you're building are Javascript or NodeJS application. If you're building a .war, I assume you're using Java (or another JVM language)?

In that case, instead of using NPM commands, you would use whatever commands you use locally to build you .war (such as Maven or Gradle).

Likewise, your Dockerfile would have to be modified to handle Java instead of NPM:

FROM openjdk:8

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Add the .war
COPY . /usr/src/app

EXPOSE 8080
CMD [ "java", "/usr/src/app/.war" ] # replace this with whatever command you use to start your application.

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events