learnsteam-quiz-api/docker/local/Dockerfile
2023-11-17 14:27:42 +09:00

21 lines
497 B
Docker

# syntax=docker/dockerfile:1
FROM golang:alpine AS deps
RUN apk add --no-cache mariadb-dev sqlite-dev build-base
FROM deps AS builder
WORKDIR /app
COPY . .
RUN cp configs/common.local configs/common.go
RUN go mod download && go mod verify
RUN CGO_ENABLED=1 go build -v -o bootstrap cmd/main.go
FROM alpine:latest AS runner
WORKDIR /app
RUN apk add --no-cache sqlite-libs mariadb-connector-c libgcc
COPY --from=builder /app/bootstrap .
EXPOSE 3030
ENV PORT 3030
CMD ["sh", "-c", "./bootstrap"]