| 1234567891011121314151617181920 |
- FROM golang:1.22-alpine AS builder
- RUN apk add --no-cache git
- WORKDIR /app
- COPY go.mod ./
- RUN go mod download
- COPY . .
- RUN go mod tidy
- RUN CGO_ENABLED=0 GOOS=linux go build -o /photoplaces-api ./cmd/api
- FROM alpine:3.19
- RUN apk add --no-cache ca-certificates tzdata postgresql-client
- RUN wget -qO- https://github.com/golang-migrate/migrate/releases/download/v4.17.1/migrate.linux-amd64.tar.gz | tar xz -C /usr/local/bin migrate
- COPY --from=builder /photoplaces-api /photoplaces-api
- COPY --from=builder /app/migrations /migrations
- COPY docker-entrypoint.sh /docker-entrypoint.sh
- RUN chmod +x /docker-entrypoint.sh
- EXPOSE 8080
- ENTRYPOINT ["/docker-entrypoint.sh"]
|