forked from cloud-barista/cb-larva
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-controller
38 lines (25 loc) · 1.14 KB
/
Dockerfile-controller
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
## This is a Dockerfile for cb-network controller
##############################################################
## Stage 1 - Go Build
##############################################################
FROM golang:1.19 AS builder
ENV GO111MODULE=on
COPY . /cb-larva
WORKDIR /cb-larva/poc-cb-net/cmd/controller
# Build the controller
# Note - Using cgo write normal Go code that imports a pseudo-package "C". I may not need on cross-compiling.
# Note - You can find possible platforms by 'go tool dist list' for GOOS and GOARCH
# Note - Using the -ldflags parameter can help set variable values at compile time.
# Note - Using the -s and -w linker flags can strip the debugging information.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-s -w' -o controller
#############################################################
## Stage 2 - Application Setup
##############################################################
FROM alpine:latest
WORKDIR /app
RUN mkdir -p config
# Copy the execution file
COPY --from=builder /cb-larva/poc-cb-net/cmd/controller/controller .
# ports for the cb-network controller
# EXPOSE 8051
ENTRYPOINT ["./controller"]