2022-07-13 15:52:25 -07:00
|
|
|
FROM golang:1.18.4 as build
|
2022-04-02 12:05:32 -07:00
|
|
|
|
|
|
|
COPY . /app
|
|
|
|
WORKDIR /app
|
2023-01-31 17:47:04 -08:00
|
|
|
|
|
|
|
# Always make sure that swagger docs are updated
|
|
|
|
RUN go install github.com/swaggo/swag/cmd/swag@latest
|
|
|
|
RUN /go/bin/swag i
|
|
|
|
|
|
|
|
# Always build the latest sql queries
|
|
|
|
RUN go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
|
|
|
|
RUN /go/bin/sqlc generate
|
|
|
|
|
2022-04-02 12:05:32 -07:00
|
|
|
RUN go build .
|
2022-06-08 21:17:08 -07:00
|
|
|
RUN go install github.com/pressly/goose/v3/cmd/goose@latest
|
2022-04-02 12:05:32 -07:00
|
|
|
|
2022-07-13 15:52:25 -07:00
|
|
|
FROM alpine:latest as app
|
2022-04-02 12:05:32 -07:00
|
|
|
|
2022-07-14 14:27:40 -07:00
|
|
|
RUN apk --no-cache add bash
|
|
|
|
RUN apk --no-cache add libc6-compat
|
|
|
|
RUN apk --no-cache add chromium
|
|
|
|
|
2022-07-13 15:52:25 -07:00
|
|
|
RUN mkdir /app && mkdir /app/migrations
|
2022-04-02 12:09:43 -07:00
|
|
|
COPY --from=build /app/collector /app
|
2022-06-08 21:17:08 -07:00
|
|
|
COPY --from=build /go/bin/goose /app
|
|
|
|
COPY ./database/migrations/ /app/migrations
|
|
|
|
|
2022-07-13 15:52:25 -07:00
|
|
|
CMD [ "/app/collector" ]
|