Skip to content

Commit a2fe77e

Browse files
authored
Merge pull request #334 from gravitl/master
updated compose files
2 parents 7dd87a1 + fb6bffd commit a2fe77e

File tree

11 files changed

+102
-96
lines changed

11 files changed

+102
-96
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
config/dnsconfig/
2+
data/

Dockerfile

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,26 @@
11
#first stage - builder
2-
3-
FROM golang:latest as builder
4-
5-
COPY . /app
2+
FROM gravitl/builder as builder
63

74
WORKDIR /app
85

9-
ENV GO111MODULE=auto
10-
11-
RUN GOARCH=amd64 CGO_ENABLED=1 GOOS=linux go build -ldflags="-w -s" -o app main.go
12-
13-
WORKDIR /app/netclient
6+
COPY . .
147

158
ENV GO111MODULE=auto
169

17-
RUN GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o netclient main.go
18-
19-
#second stage
20-
21-
FROM debian:latest
22-
23-
RUN apt-get update && apt-get -y install systemd procps
10+
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=1 /usr/local/go/bin/go build -ldflags="-w -s" -o netmaker main.go
2411

12+
FROM alpine:3.13.6
13+
# add a c lib
14+
RUN apk add gcompat iptables
15+
# set the working directory
2516
WORKDIR /root/
2617

27-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
18+
RUN mkdir -p /etc/netclient/config
2819

29-
COPY --from=builder /app .
20+
COPY --from=builder /app/netmaker .
3021
COPY --from=builder /app/config config
31-
COPY --from=builder /app/netclient netclient
3222

3323
EXPOSE 8081
3424
EXPOSE 50051
3525

36-
CMD ["./app"]
26+
ENTRYPOINT ["./netmaker"]

compose/docker-compose.caddy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
SERVER_GRPC_HOST: "grpc.NETMAKER_BASE_DOMAIN"
2525
API_PORT: "8081"
2626
GRPC_PORT: "50051"
27-
CLIENT_MODE: "contained"
27+
CLIENT_MODE: "on"
2828
MASTER_KEY: "REPLACE_MASTER_KEY"
2929
SERVER_GRPC_WIREGUARD: "off"
3030
CORS_ALLOWED_ORIGIN: "*"

compose/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
SERVER_GRPC_HOST: "grpc.NETMAKER_BASE_DOMAIN"
2525
API_PORT: "8081"
2626
GRPC_PORT: "50051"
27-
CLIENT_MODE: "contained"
27+
CLIENT_MODE: "on"
2828
MASTER_KEY: "REPLACE_MASTER_KEY"
2929
SERVER_GRPC_WIREGUARD: "off"
3030
CORS_ALLOWED_ORIGIN: "*"

docker/Dockerfile-full

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#first stage - builder
2+
3+
FROM golang:latest as builder
4+
5+
COPY . /app
6+
7+
WORKDIR /app
8+
9+
ENV GO111MODULE=auto
10+
11+
RUN GOARCH=amd64 CGO_ENABLED=1 GOOS=linux go build -ldflags="-w -s" -o app main.go
12+
13+
WORKDIR /app/netclient
14+
15+
ENV GO111MODULE=auto
16+
17+
RUN GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o netclient main.go
18+
19+
#second stage
20+
21+
FROM debian:latest
22+
23+
RUN apt-get update && apt-get -y install systemd procps
24+
25+
WORKDIR /root/
26+
27+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
28+
29+
COPY --from=builder /app .
30+
COPY --from=builder /app/config config
31+
COPY --from=builder /app/netclient netclient
32+
33+
EXPOSE 8081
34+
EXPOSE 50051
35+
36+
CMD ["./app"]

docker/Dockerfile-netclient

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
#first stage - builder
1+
FROM gravitl/builder:latest as builder
2+
# add glib support daemon manager
3+
WORKDIR /app
24

3-
FROM golang:latest as builder
4-
5-
COPY . /app
6-
7-
WORKDIR /app/netclient
5+
COPY . .
86

97
ENV GO111MODULE=auto
108

11-
RUN CGO_ENABLED=0 GOOS=linux go build -o netclient main.go
12-
13-
#second stage
9+
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go
1410

15-
FROM debian:latest
16-
17-
RUN apt-get update && apt-get -y install systemd procps
11+
FROM alpine:3.13.6
1812

13+
RUN apk add gcompat iptables && mkdir -p /etc/netclient
14+
# set the working directory
1915
WORKDIR /root/
2016

21-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
22-
23-
COPY --from=builder /app/netclient/netclient .
17+
COPY --from=builder /app/netclient-app /etc/netclient/netclient
18+
COPY --from=builder /app/scripts/netclient.sh .
2419

25-
CMD ["./netclient"]
20+
RUN chmod 0755 /etc/netclient/netclient && chmod 0755 netclient.sh
2621

22+
ENTRYPOINT ["./netclient.sh"]

docker/Dockerfile-netclient-full

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#first stage - builder
2+
3+
FROM golang:latest as builder
4+
5+
COPY . /app
6+
7+
WORKDIR /app/netclient
8+
9+
ENV GO111MODULE=auto
10+
11+
RUN CGO_ENABLED=0 GOOS=linux go build -o netclient main.go
12+
13+
#second stage
14+
15+
FROM debian:latest
16+
17+
RUN apt-get update && apt-get -y install systemd procps
18+
19+
WORKDIR /root/
20+
21+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
22+
23+
COPY --from=builder /app/netclient/netclient .
24+
25+
CMD ["./netclient"]
26+

docker/Dockerfile-netclient-slim-solo

Lines changed: 0 additions & 22 deletions
This file was deleted.

docker/Dockerfile-netmaker-slim-solo

Lines changed: 0 additions & 26 deletions
This file was deleted.

netclient/command/commands.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package command
33
import (
44
"log"
55
"os"
6+
"strconv"
67
"strings"
78
"time"
8-
"strconv"
9+
910
nodepb "github.com/gravitl/netmaker/grpc"
1011
"github.com/gravitl/netmaker/netclient/config"
1112
"github.com/gravitl/netmaker/netclient/daemon"
@@ -67,14 +68,14 @@ func getWindowsInterval() int {
6768
return interval
6869
}
6970
netint, err := strconv.Atoi(cfg.Server.CheckinInterval)
70-
if err == nil && netint != 0 {
71+
if err == nil && netint != 0 {
7172
interval = netint
7273
}
7374
return interval
7475
}
7576

7677
func RunUserspaceDaemon() {
77-
78+
7879
cfg := config.ClientConfig{
7980
Network: "all",
8081
}

0 commit comments

Comments
 (0)