-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.schedular
28 lines (18 loc) · 1.16 KB
/
Dockerfile.schedular
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM golang:alpine
WORKDIR /app
RUN apk add --no-cache postgresql-client
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN echo '#!/bin/sh' > wait-for-db.sh && \
echo 'until pg_isready -h postgres -p 5432 -U postgres; do' >> wait-for-db.sh && \
echo ' echo "Waiting for postgres..."' >> wait-for-db.sh && \
echo ' sleep 2' >> wait-for-db.sh && \
echo 'done' >> wait-for-db.sh && \
echo 'echo "PostgreSQL started"' >> wait-for-db.sh && \
echo 'exec "$@"' >> wait-for-db.sh && \
chmod +x wait-for-db.sh
EXPOSE 8080
# CMD ["./wait-for-db.sh", "sh", "-c", "go run github.com/steebchen/prisma-client-go migrate deploy --preview-feature && touch /app/migrations_complete && echo 'Migrations completed' && go run cmd/schedular/main.go -port 8080"]
# && touch /app/migrations_complete && echo 'Migrations completed'
CMD ["./wait-for-db.sh", "sh", "-c", "go run github.com/steebchen/prisma-client-go migrate dev --name add --preview-feature --create-only && go run github.com/steebchen/prisma-client-go migrate deploy --preview-feature && touch /app/migrations_complete && echo 'Migrations completed' && go run cmd/schedular/main.go -port 8080"]