Skip to content

Commit

Permalink
Added Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Apurva14A committed Aug 8, 2023
1 parent 9c0f352 commit f6ef075
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: onlinebookstore
path: staging

- name: Test the arifacts
run: ls -R
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: OnlineBookStoreImageBuild

on: [push]

jobs:
build-image:
name: Build the image
runs-on: ubuntu:latest

steps:

- name: Checkout repo
uses: actions/checkout@v3

- name: Setup java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- run: mvn --batch-mode --update-snapshots verify
- run: mkdir staging && cp target/*.war staging

- name: Image build using Dockerfile
run :
docker build -t aapurva/java-webapps:v1.0.0 ../Dockerfile


14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use an official Tomcat image as the base
FROM tomcat:9.0-jdk11

# Remove the default Tomcat applications
RUN rm -rf /usr/local/tomcat/webapps/*

# Copy the .war artifact from the artifacts directory to the Tomcat webapps directory
COPY ./staging/*.war /usr/local/tomcat/webapps/ROOT.war

# Expose the Tomcat port
EXPOSE 8080

# Start Tomcat
CMD ["catalina.sh", "run"]

0 comments on commit f6ef075

Please sign in to comment.