-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
24 lines (17 loc) · 925 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
# ===================================================================================
# === Stage 1: Build the Go service code into 'server' exe ==========================
# ===================================================================================
FROM golang:1.19-alpine AS builder
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux go build -o app cmd/server/main.go
# RUN go install github.com/cosmtrek/air@latest
# RUN curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s
# ================================================================================================
# === Stage 2: Get server binary into a lightweight container ====================================
# ================================================================================================
FROM alpine:latest AS production
COPY --from=builder /app .
# CMD ["air"]
CMD ["./app"]