Skip to content

Commit

Permalink
Merge pull request #1453 from ABGEO/feat/improve-docker-build
Browse files Browse the repository at this point in the history
refactor: improve docker environment
  • Loading branch information
Tronje Krop authored Dec 15, 2023
2 parents e6a810e + 62ac6c8 commit bae01b9
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Trying out Zally is easy. You can build and run the whole Zally stack (web-ui, s
and database) by executing:

```bash
./build-and-run.sh
docker compose up -d
```

Web UI is accessible on `http://localhost:8080`; Zally server on `http://localhost:8000`
Expand Down
21 changes: 0 additions & 21 deletions build-and-run.sh

This file was deleted.

43 changes: 23 additions & 20 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,51 @@ services:
web-ui:
build: ./web-ui
environment:
- ZALLY_API_URL=${ZALLY_API_URL:-http://localhost:8000}
- ZALLY_API_URL=${ZALLY_API_URL:-http://localhost:8000}
depends_on:
- server
- server
links:
- server:server.local
- server:server.local
ports:
- "8080:3000"
- "8080:3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
test: [ "CMD", "curl", "-f", "http://localhost:3000" ]
interval: 5s
timeout: 2s
retries: 10

server:
build: ./server
depends_on:
- postgres
- postgres
links:
- postgres:postgres.local
- postgres:postgres.local
ports:
- "8000:8000"
- "8000:8000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7979/health"]
test: [ "CMD", "curl", "-f", "http://localhost:7979/health" ]
interval: 5s
timeout: 2s
retries: 10
environment:
- SPRING_PROFILES_ACTIVE=dev
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres.local:5432/zally
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
- MANAGEMENT_PORT=7979
- TOKEN_INFO_URI=https://url.not.set
- SPRING_PROFILES_ACTIVE=dev
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres.local:5432/zally
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
- MANAGEMENT_PORT=7979
- TOKEN_INFO_URI=https://url.not.set
postgres:
image: postgres:13
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=zally
ports:
- "54321:5432"
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=zally
volumes:
- "postgres-data:/var/lib/postgresql/data"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
test: [ "CMD", "pg_isready", "-U", "postgres" ]
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres-data:
3 changes: 3 additions & 0 deletions server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gradle
build
Dockerfile
10 changes: 9 additions & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
FROM eclipse-temurin:17 as builder

WORKDIR /var/app

COPY . .
RUN ./gradlew
RUN ./gradlew build

FROM eclipse-temurin:17

LABEL org.opencontainers.image.authors="https://opensource.zalando.com/"

COPY zally-server/src/main/resources/api/zally-api.yaml /zalando-apis/zally-api.yaml
COPY zally-server/build/libs/zally-server.jar /
COPY --from=builder /var/app/zally-server/build/libs/zally-server.jar /

EXPOSE 8080

Expand Down
1 change: 1 addition & 0 deletions web-ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
target
Dockerfile
2 changes: 2 additions & 0 deletions web-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM registry.opensource.zalan.do/library/node-18-alpine:latest

MAINTAINER "http://zalando.github.io/"

RUN apk --no-cache add curl

COPY package.json ./
COPY yarn.lock ./

Expand Down

0 comments on commit bae01b9

Please sign in to comment.