-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
46 lines (32 loc) · 807 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
42
43
44
45
46
###################
# 1. Building stage
###################
FROM golang:1.23.4 AS build-stage
# Set destination for COPY
WORKDIR /waku-cli
# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
# Copy the source code.
COPY *.go ./
COPY cmd/ pkg/ internal/ ./
# Build
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o waku
###################
# 2. Run tests
###################
FROM build-stage AS run-test-stage
RUN go test -v ./...
###################
# 3. Deploying
###################
FROM alpine:3.21.0 AS deploy-stage
WORKDIR /app
# Install git
RUN apk add --update --no-cache tini git && rm -rf /var/cache/apk/*
RUN adduser -D waku
USER waku
# Copy bins from build stage
COPY --from=build-stage /waku-cli/waku /usr/bin/waku
# Run
ENTRYPOINT ["/sbin/tini", "--", "waku"]