-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (30 loc) · 1.35 KB
/
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
# +-----------------------------------------------------------------------------
# | Pull vendor dependencies
# +-----------------------------------------------------------------------------
FROM golang:1.22.3-alpine as vendor
RUN mkdir /app && mkdir /build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
# +-----------------------------------------------------------------------------
# | Base layer for the hot-reloading development images
# +-----------------------------------------------------------------------------
FROM vendor as hot-reload
ENTRYPOINT [ "CompileDaemon" ]
# Install CompileDaemon, which will watch for changes in the source code and
# recompile the binaries on the fly.
RUN apk add --no-cache git
RUN go get github.com/githubnemo/CompileDaemon &&\
go install github.com/githubnemo/CompileDaemon
# +-----------------------------------------------------------------------------
# | Build the binaries
# +-----------------------------------------------------------------------------
FROM vendor AS builder
COPY . .
RUN go build -o /build/apiserver cmd/apiserver/main.go
# +-----------------------------------------------------------------------------
# | Create the final image
# +-----------------------------------------------------------------------------
FROM alpine:3.19
COPY ./static ./static
COPY --from=builder /build/* /app/main