forked from networkservicemesh/cmd-forwarder-ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (30 loc) · 1.12 KB
/
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
FROM golang:1.16.3-buster as go
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOBIN=/bin
RUN go get github.com/go-delve/delve/cmd/[email protected]
RUN go get github.com/edwarnicke/dl
RUN dl https://github.com/spiffe/spire/releases/download/v0.11.1/spire-0.11.1-linux-x86_64-glibc.tar.gz | \
tar -xzvf - -C /bin --strip=3 ./spire-0.11.1/bin/spire-server ./spire-0.11.1/bin/spire-agent
FROM go as build
WORKDIR /build
COPY go.mod go.sum ./
COPY . .
RUN go build -o /bin/forwarder .
FROM build as test
CMD go test -test.v ./...
FROM test as debug
CMD dlv -l :40000 --headless=true --api-version=2 test -test.v ./...
FROM alpine as runtime
COPY --from=build /bin/forwarder /bin/forwarder
RUN apk --update add supervisor \
openvswitch
# Create database and pid file directory
RUN /usr/bin/ovsdb-tool create /etc/openvswitch/conf.db
RUN mkdir -pv /var/run/openvswitch/
# Add configuration files
ADD build/supervisord.conf /etc/supervisord.conf
ADD build/configure-ovs.sh /usr/share/openvswitch/
RUN chmod 755 /usr/share/openvswitch/configure-ovs.sh
# When container starts, run supervisord process
ENTRYPOINT ["/usr/bin/supervisord"]