1- FROM golang:1.22 AS builder
1+ # Build stage
2+ FROM golang:1.23 AS buildstage
23
3- WORKDIR /go/src/go -fula
4+ WORKDIR /go-fula
45
5- COPY go.mod go.sum ./
6- RUN go mod download
6+ # Copy go module files and download dependencies
7+ COPY ./go-fula/go.mod ./go-fula/go.sum ./
8+ RUN go mod download -x
79
8- COPY . .
9- RUN CGO_ENABLED=0 go build -o /go/bin/blox ./cmd/blox
10+ # Copy the rest of the application source code
11+ COPY ./go-fula/ .
1012
11- FROM gcr.io/distroless/static-debian11
12- COPY --from=builder /go/bin/blox /usr/bin/
13+ # Build binaries with CGO disabled for static binaries
14+ RUN CGO_ENABLED=0 GOOS=linux go build -o /app ./cmd/blox && \
15+ CGO_ENABLED=0 GOOS=linux go build -o /wap ./wap/cmd && \
16+ CGO_ENABLED=0 GOOS=linux go build -o /initipfs ./modules/initipfs && \
17+ CGO_ENABLED=0 GOOS=linux go build -o /initipfscluster ./modules/initipfscluster
1318
14- ENTRYPOINT ["/usr/bin/blox" ]
19+ # Final stage
20+ FROM alpine:3.17
21+
22+ # Install necessary packages
23+ RUN apk update && \
24+ apk add --no-cache hostapd iw wireless-tools networkmanager-wifi networkmanager-cli dhcp iptables curl mergerfs --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing
25+
26+ WORKDIR /
27+
28+ # Copy binaries from the build stage
29+ COPY --from=buildstage /app /app
30+ COPY --from=buildstage /wap /wap
31+ COPY --from=buildstage /initipfs /initipfs
32+ COPY --from=buildstage /initipfscluster /initipfscluster
33+
34+ # Copy and set permissions for the startup script
35+ COPY ./go-fula.sh /go-fula.sh
36+ RUN chmod +x /go-fula.sh
37+
38+ # Expose necessary ports
39+ EXPOSE 40001 5001
40+
41+ # Set the entrypoint command
42+ CMD ["/go-fula.sh" ]
0 commit comments