forked from w3c/automotive-viss2
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.agtserver
60 lines (49 loc) · 2.03 KB
/
Dockerfile.agtserver
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# (C) 2023 Volvo Cars
#
# All files and artifacts in the repository at https://github.com/w3c/automotive-vissv2
# are licensed under the provisions of the license provided by the LICENSE file in this repository.
# To run with redis as state storage use docker compose. This can be used to build individual images but will not
# run.
ARG GO_VERSION=1.22.1
ARG VSSTREE_NAME="vss_vissv2.binary"
ARG BUILD_IMAGE="golang:latest"
ARG RUNTIME_IMAGE="debian:bullseye-slim"
#----------------------Builder-----------------------
FROM ${BUILD_IMAGE} AS builder
ARG VSSTREE_NAME
WORKDIR /build
#add bin folder to store the compiled files
RUN mkdir bin
#corporate proxy settings can sometimes cause tls verification error. Add root crt to docker container.
COPY testCredGen/cicso-umbrella/cisco.crt /usr/local/share/ca-certificates/cisco.crt
RUN update-ca-certificates
#copy the content of the server and utils dir and .mod/.sum files to builder
COPY server/ ./server
COPY grpc_pb/ ./grpc_pb
COPY protobuf/ ./protobuf
COPY utils/ ./utils
COPY go.mod go.sum ./
#RUN ls -a etc/
#copy cert info from testCredGen to path expected by w3c server
#COPY testCredGen/ca transport_sec/ca
COPY testCredGen/server transport_sec/server
COPY testCredGen/client transport_sec/client
#clean up unused dependencies
#RUN go mod tidy
#compile all projects and place the executables in the bin folder
RUN go build -v -o ./bin ./...
#----------------------runtime-----------------------
FROM ${RUNTIME_IMAGE} AS runtime
RUN apt-get update && apt-get upgrade -y
RUN apt-get update && apt-get install -y net-tools iproute2 iputils-ping
RUN apt-get autoclean -y
RUN apt-get autoremove -y
COPY --from=builder /build/transport_sec/ ../transport_sec/.
FROM golang:latest as agt_server
USER root
RUN mkdir transport_sec
WORKDIR /app
COPY --from=builder /build/bin/agt_server .
COPY --from=builder /build/server/transport_sec/transportSec.json ../transport_sec/transportSec.json
COPY --from=builder /build/server/agt_server/agt_public_key.rsa .
COPY --from=builder /build/server/agt_server/agt_private_key.rsa .