-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WFPREV-145 - Initial Rest endpoints including projects (#326)
Co-authored-by: Dylan Hemsworth <[email protected]> Co-authored-by: Sean Sylver <[email protected]> Co-authored-by: ssylver93 <[email protected]> Co-authored-by: Chris Preston <[email protected]>
- Loading branch information
1 parent
577de38
commit 48f6f29
Showing
80 changed files
with
5,607 additions
and
1,247 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
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,3 +1,4 @@ | ||
htmlReport/ | ||
/target | ||
/.vscode | ||
/.idea | ||
|
@@ -9,4 +10,4 @@ | |
**/.env | ||
**/.env.* | ||
.DS_Store | ||
**/.DS_Store | ||
**/.DS_Store |
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
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
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,72 @@ | ||
services: | ||
api: | ||
build: | ||
context: . | ||
dockerfile: server/wfprev-api/Dockerfile.graalvm | ||
# Pass the maven settings file and repo credentials as build args | ||
args: | ||
- MAVEN_SETTINGS_FILE=vivid.settings.xml | ||
- REPO_LOGIN=${REPO_LOGIN} | ||
- REPO_PASSWORD=${REPO_PASSWORD} | ||
environment: | ||
# Environment variables for the application | ||
WFPREV_DATASOURCE_URL: ${WFPREV_DATASOURCE_URL} | ||
WFPREV_DATASOURCE_USERNAME: ${WFPREV_DATASOURCE_USERNAME} | ||
WFPREV_DATASOURCE_PASSWORD: ${WFPREV_DATASOURCE_PASSWORD} | ||
ports: | ||
- "8080:8080" # Map the API's port to the host | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
networks: | ||
- wfprev-network | ||
env_file: | ||
- .env | ||
|
||
liquibase: | ||
build: | ||
context: db | ||
dockerfile: Dockerfile.liquibase.local | ||
command: [ | ||
"liquibase", | ||
"--url=jdbc:postgresql://wfprev-postgres:5432/wfprev", | ||
"--changelog-file=db/main-changelog.json", | ||
"--username=wfprev", | ||
"--password=${POSTGRES_PASSWORD}", | ||
"update" | ||
] | ||
volumes: | ||
- ./db:/liquibase/db | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
networks: | ||
- wfprev-network | ||
|
||
db: | ||
image: postgis/postgis:16-3.4 | ||
container_name: wfprev-postgres | ||
environment: | ||
POSTGRES_USER: wfprev | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
POSTGRES_DB: wfprev | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
networks: | ||
- wfprev-network | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U wfprev -d wfprev" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
start_period: 10s | ||
|
||
networks: | ||
wfprev-network: | ||
driver: bridge | ||
|
||
volumes: | ||
postgres_data: | ||
driver: local |
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 |
---|---|---|
|
@@ -36,4 +36,4 @@ build/ | |
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
.vscode/ |
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,52 @@ | ||
# Build stage | ||
FROM ghcr.io/graalvm/graalvm-community:21 AS builder | ||
|
||
# Define build argument and set it as environment variable | ||
ARG MAVEN_SETTINGS_FILE=settings.xml | ||
|
||
ENV MAVEN_SETTINGS_FILE=${MAVEN_SETTINGS_FILE} | ||
|
||
# The environment variables from .env are automatically available here | ||
# We don't need the ARG declarations anymore since we're using the env file | ||
|
||
WORKDIR /app | ||
|
||
# Copy maven settings first | ||
COPY mvn_settings/${MAVEN_SETTINGS_FILE} /root/.m2/settings.xml | ||
|
||
# Copy rest of the application | ||
COPY . /app | ||
|
||
# Make mvnw executable | ||
RUN chmod +x mvnw | ||
|
||
# Create the directory for GraalVM agent metadata and set permissions | ||
RUN mkdir -p /app/META-INF/native-image | ||
RUN chmod -R 777 /app/META-INF/native-image | ||
|
||
# Run the GraalVM agent during the build stage | ||
RUN java -agentlib:native-image-agent=config-output-dir=META-INF/native-image \ | ||
-Dspring.profiles.active=graalvm-agent \ | ||
-jar target/wfprev-api-1.0.0-SNAPSHOT.jar || true | ||
|
||
|
||
# Build the native image using settings.xml | ||
RUN ./mvnw -s mvn_settings/${MAVEN_SETTINGS_FILE} -Pnative native:compile | ||
|
||
# Runtime stage | ||
FROM ubuntu:22.04 | ||
|
||
# Install curl for healthcheck and debugging | ||
RUN apt-get update && apt-get install -y \ | ||
libc6 \ | ||
libstdc++6 \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the native executable from builder stage | ||
COPY --from=builder /app/target/wfprev-api / | ||
|
||
# Expose the port your application uses | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["/wfprev-api"] |
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,52 @@ | ||
# Use Eclipse Temurin's Java 21 image as the base | ||
FROM eclipse-temurin:21-jdk-jammy | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install required utilities | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy Maven settings | ||
ARG MAVEN_SETTINGS_FILE=settings.xml | ||
COPY mvn_settings/${MAVEN_SETTINGS_FILE} /root/.m2/settings.xml | ||
|
||
# Copy source code and Maven wrapper | ||
COPY .mvn/ .mvn/ | ||
COPY mvnw pom.xml ./ | ||
RUN chmod +x mvnw | ||
|
||
# Download dependencies separately to leverage Docker cache | ||
RUN ./mvnw dependency:go-offline -s /root/.m2/settings.xml | ||
|
||
# Copy the rest of the application | ||
COPY src ./src/ | ||
|
||
# Expose ports for the application and debugging | ||
EXPOSE 8080 | ||
EXPOSE 5005 | ||
|
||
# Create start script with debug options | ||
COPY <<EOF /app/start.sh | ||
#!/bin/sh | ||
echo "==== Environment Variables ====" | ||
echo "WFPREV_DATASOURCE_URL: \${WFPREV_DATASOURCE_URL}" | ||
echo "WFPREV_DATASOURCE_USERNAME: \${WFPREV_DATASOURCE_USERNAME}" | ||
echo "Database connection test:" | ||
|
||
until pg_isready -h db -U \${WFPREV_DATASOURCE_USERNAME}; do | ||
echo "Waiting for database connection..." | ||
sleep 2 | ||
done | ||
|
||
echo "Starting application in debug mode..." | ||
exec ./mvnw spring-boot:run \ | ||
-Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" | ||
EOF | ||
|
||
RUN chmod +x /app/start.sh | ||
|
||
ENTRYPOINT ["/app/start.sh"] |
Oops, something went wrong.