Skip to content

Commit

Permalink
Add API service to Docker (#338)
Browse files Browse the repository at this point in the history
Builds a live reloading instance of the api service for development. You
will need to build the java code (`./gradlew build`) but then the server
will pick up the changes.
  • Loading branch information
schreiaj authored Oct 18, 2024
1 parent a753cbe commit 08371b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions backend/dev-dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM amazoncorretto:17
ENV HOME=/app
RUN mkdir -p $HOME
WORKDIR $HOME
8 changes: 4 additions & 4 deletions backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
spring:
datasource:
url: jdbc:postgresql://localhost:5432/reportvision
username: postgres
password: super_secret_password
url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:reportvision}
username: ${DB_USERNAME:postgres}
password: ${DB_PASSWORD:super_secret_password}
devtools:
restart:
enabled: true
Expand All @@ -20,4 +20,4 @@ management:
include: "*"
endpoint:
health:
show-details: never
show-details: always
18 changes: 18 additions & 0 deletions dev-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ services:
- "8080:8080"
volumes:
- ./frontend:/app
depends_on:
- api
- ocr
restart: "no"
command: "/bin/sh -c 'npm install && npx playwright install && npx playwright test --ui-port=8080 --ui-host=0.0.0.0 & npm run dev -- --host'"
db:
Expand All @@ -30,3 +33,18 @@ services:
POSTGRES_DB: reportvision
POSTGRES_USER: postgres
POSTGRES_PASSWORD: super_secret_password
api:
build:
context: ./backend
dockerfile: dev-dockerfile
environment:
- DB_HOST=db
ports:
- "8081:8081"
volumes:
- ./backend:/app
restart: "unless-stopped"
depends_on:
- db
command: "./gradlew bootRun --continuous --args='--server.port=8081'"

0 comments on commit 08371b5

Please sign in to comment.