-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modififed Dockerfile and Dockercompose
- Loading branch information
1 parent
b443d2d
commit f30ea1e
Showing
4 changed files
with
41 additions
and
26 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 |
---|---|---|
@@ -1,24 +1,5 @@ | ||
FROM gradle:7.6.1-jdk17-alpine AS build | ||
FROM openjdk:17 | ||
WORKDIR /app | ||
COPY . . | ||
RUN gradle build -x test --no-daemon | ||
COPY build/libs/*.jar app.jar | ||
|
||
# Run stage | ||
FROM eclipse-temurin:17-jre-alpine | ||
WORKDIR /app | ||
|
||
# Create a non-root user | ||
RUN addgroup -S spring && adduser -S spring -G spring | ||
USER spring:spring | ||
|
||
# Copy the jar file from build stage | ||
COPY --from=build /app/build/libs/*.jar app.jar | ||
|
||
# Environment variables for database connection | ||
ENV SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/blueprint | ||
ENV SPRING_DATASOURCE_USERNAME=postgres | ||
ENV SPRING_DATASOURCE_PASSWORD=postgres | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["java", "-jar", "app.jar"] | ||
ENTRYPOINT ["java", "-jar", "app.jar"] |
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,32 @@ | ||
services: | ||
blueprint_admin_backend: | ||
env_file: ".env" | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
environment: | ||
- DATABASE_URL=jdbc:postgresql://postgres:5432/${POSTGRES_DB} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
ports: | ||
- '8080:8080' | ||
depends_on: | ||
- postgres | ||
|
||
postgres: | ||
env_file: ".env" | ||
image: postgres:latest | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
logging: | ||
options: | ||
max-size: "10m" | ||
max-file: "3" | ||
ports: | ||
- '5432:5432' | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
- ./initdb_prod:/docker-entrypoint-initdb.d |
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