newsbot-api/Dockerfile

28 lines
684 B
Docker
Raw Normal View History

2024-04-28 11:42:10 -07:00
FROM golang:1.22 as build
COPY . /app
WORKDIR /app
# 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
RUN go build .
RUN go install github.com/pressly/goose/v3/cmd/goose@latest
FROM alpine:latest as app
RUN apk --no-cache add bash
RUN apk --no-cache add libc6-compat
RUN apk --no-cache add chromium
RUN mkdir /app && mkdir /app/migrations
COPY --from=build /app/collector /app
COPY --from=build /go/bin/goose /app
COPY ./database/migrations/ /app/migrations
CMD [ "/app/collector" ]