Skip to content

Commit

Permalink
change Dockerfile to build .war and add simple build docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
frnandu committed Nov 8, 2024
1 parent 8fc2218 commit ff05a7a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Continuous Integration

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Docker build
uses: mr-smithers-excellent/docker-build-push@v5
id: build
with:
image: ${{ env.IMAGENAME }}
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
14 changes: 9 additions & 5 deletions java/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM gradle:jdk17-jammy as builder

WORKDIR /build
COPY . ./
RUN gradle wrapper --gradle-version 8.1.1
RUN ./gradlew build -x test

##########################################################################
# Use official Tomcat base image
FROM tomcat:jre17

# Copy WAR file
COPY app/build/libs/vss-1.0.war /usr/local/tomcat/webapps/vss.war

ENV vss.jdbc.url="jdbc:postgresql://postgres:5432/postgres"
ENV vss.jdbc.username=postgres
ENV vss.jdbc.password=YOU_MUST_CHANGE_THIS_PASSWORD
COPY --from=builder /build/app/build/libs/vss-1.0.war /usr/local/tomcat/webapps/vss.war

EXPOSE 8080
CMD ["catalina.sh", "run"]

0 comments on commit ff05a7a

Please sign in to comment.