-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (24 loc) · 831 Bytes
/
Dockerfile
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
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM golang:alpine AS base
# Development stage
FROM base AS development
WORKDIR /app
# Install the air CLI for auto-reloading
RUN go install github.com/air-verse/air@latest
COPY go.mod /app/
RUN go mod download
CMD ["air", "-c", ".air.toml"]
# Buider Stage
FROM base AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o main ./cmd/web
FROM scratch AS production
LABEL org.opencontainers.image.title="Snipbox"
LABEL org.opencontainers.image.description="A lightweight Go application."
LABEL org.opencontainers.image.authors="Nimendra <[email protected]>"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/nmdra/snipbox"
COPY --from=builder /build/main ./
CMD ["./main"]