-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfileBuild
More file actions
35 lines (25 loc) · 958 Bytes
/
DockerfileBuild
File metadata and controls
35 lines (25 loc) · 958 Bytes
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
# Use the official Golang image
FROM golang:1.23-alpine as builder
# Set the working directory
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod tidy
# Copy the entire source code
COPY . .
# Build the Go app
RUN go build -o wireguard-api cmd/server/main.go
RUN go build -o api-key-generator cmd/generator/api_secret/main.go
RUN go build -o wireguard-tools cmd/cli/main.go
RUN go build -o wireguard-stream cmd/stream/main.go
FROM alpine:latest
# Install necessary dependencies
RUN apk --no-cache add ca-certificates
# Copy the built app from the builder stage
COPY --from=builder /app/wireguard-api /bin/wireguard-api
COPY --from=builder /app/api-key-generator /bin/api-key-generator
COPY --from=builder /app/wireguard-tools /bin/wireguard-tools
COPY --from=builder /app/wireguard-stream /bin/wireguard-stream
COPY --from=builder /app/scripts/docker/compiler/build /bin/build
CMD ["sh", "/bin/build"]