forked from lightningdevkit/vss-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH workflow for build and push java docker image (#2)
* change Dockerfile to build .war and add simple build docker workflow
- Loading branch information
Showing
2 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build Docker | ||
|
||
on: [push, pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGENAME: ${{ github.event.repository.name }} | ||
TAG: ${{ github.ref_name }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker build | ||
uses: mr-smithers-excellent/docker-build-push@v6 | ||
id: build | ||
with: | ||
directory: java | ||
image: ${{ env.IMAGENAME }} | ||
dockerfile: java/Dockerfile | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |