-
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.
* ci: add first pass docker scripts * ci: add volumes and more configuration for docker containers * chore: docker compose tweaks * ci: add ci.yml file * chore: pass java version into build step title --------- Co-authored-by: steve <[email protected]>
- Loading branch information
Showing
4 changed files
with
83 additions
and
0 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,20 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java-version: [17] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK ${{ matrix.java-version}} for x64 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
distribution: 'temurin' | ||
architecture: x64 | ||
cache: maven | ||
- name: Build with Maven | ||
run: mvn clean compile package -Dmaven.test.skip=true |
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,20 @@ | ||
FROM maven:3.9-eclipse-temurin-17 AS build | ||
|
||
RUN mkdir -p /usr/src/zfgcbb | ||
COPY . /usr/src/zfgcbb | ||
|
||
WORKDIR /usr/src/zfgcbb | ||
|
||
RUN mvn clean compile package -Dmaven.test.skip=true | ||
|
||
FROM postgres:16 AS database | ||
|
||
#RUN echo "CREATE DATABASE zfgcbb; CREATE USER $SPRING_DATASOURCE_USERNAME; GRANT ALL PRIVILEGES ON DATABASE zfgcbb TO $SPRING_DATASOURCE_USERNAME;" > /docker-entrypoint-initdb.d/init.sql | ||
|
||
FROM tomcat:jre17-temurin-jammy AS deploy | ||
|
||
COPY --from=build /usr/src/zfgcbb/target/*.war /usr/local/tomcat/webapps/ | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["catalina.sh", "run"] |
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,42 @@ | ||
services: | ||
postgresql: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: database | ||
container_name: zfgcbb_postgresql | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=123456 | ||
- POSTGRES_DB=zfgcbb | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready" ,"-d", "zfgcbb"] | ||
interval: 30s | ||
timeout: 60s | ||
retries: 5 | ||
start_period: 80s | ||
|
||
zfgcbb: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: deploy | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- logs:/usr/src/app/logs | ||
environment: | ||
- SPRING_DATASOURCE_URL=jdbc:postgresql://zfgcbb_postgresql:5432/zfgcbb | ||
- SPRING_DATASOURCE_USERNAME=postgres | ||
- SPRING_DATASOURCE_PASSWORD=123456 | ||
- SPRING_JPA_HIBERNATE_DDL_AUTO=create-drop | ||
depends_on: | ||
- postgresql | ||
|
||
volumes: | ||
data: | ||
logs: |
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