Skip to content

Commit

Permalink
add tcp port wait on docker entrypoint
Browse files Browse the repository at this point in the history
fixed: #399

Signed-off-by: Avelino <t@avelino.xxx>
  • Loading branch information
avelino committed Aug 17, 2020
1 parent d297ac9 commit a987afd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ RUN apk add --no-cache git && \

FROM alpine
COPY --from=builder /go/src/github.com/prest/prest/cmd/prestd/prestd /app/prestd
RUN apk add --no-cache curl
ADD ./cmd/prestd/prest.toml /app/prest.toml
CMD ["/app/prestd"]
ADD ./etc/entrypoint.sh /app/entrtpoint.sh
ENTRYPOINT [ "/app/entrtpoint.sh" ]
22 changes: 11 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
version: "3"
services:
postgres:
image: postgres
volumes:
- "./data/postgres:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
prest:
build: .
links:
Expand All @@ -8,21 +18,11 @@ services:
- PREST_DEBUG=true # remove comment for enable DEBUG mode (disable JWT)
- PREST_PG_HOST=postgres
- PREST_PG_USER=prest
# - PREST_PG_PASS=prest
- PREST_PG_PASS=prest
- PREST_PG_DATABASE=prest
- PREST_PG_PORT=5432
- PREST_JWT_DEFAULT=false # remove if need jwt
depends_on:
- postgres
ports:
- "3000:3000"
postgres:
image: postgres
volumes:
- "./data:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
4 changes: 4 additions & 0 deletions etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

curl -sfL https://raw.githubusercontent.com/gofn/tcp-port-wait/master/tcp-port-wait.sh | sh -s -- postgres 5432
/app/prestd $@

0 comments on commit a987afd

Please sign in to comment.