-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile.coordinator
39 lines (36 loc) · 1.31 KB
/
Dockerfile.coordinator
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
ARG NODE_BUILD_IMAGE=node:14
ARG GOLANG_BUILD_IMAGE=golang:1.16
ARG APP_BASE_IMAGE=ubuntu:20.04
FROM $NODE_BUILD_IMAGE as nodebuild
RUN mkdir /tmp/build
COPY frontend/package.json /tmp/build/package.json
COPY frontend/package-lock.json /tmp/build/package-lock.json
WORKDIR /tmp/build
RUN npm install
COPY frontend/src/ /tmp/build/src/
COPY frontend/public/ /tmp/build/public/
RUN mkdir /tmp/output
RUN npm install && npm run build
RUN mv build /tmp/output/
FROM $GOLANG_BUILD_IMAGE as build-env
RUN mkdir /src
COPY go.mod /src/go.mod
COPY go.sum /src/go.sum
WORKDIR /src
RUN go mod download
COPY . /src
WORKDIR /src/cmd/coordinator
ARG GIT_COMMIT=develop
ARG GIT_DATE=00000000
RUN go build -ldflags "-X main.GitCommit=$GIT_COMMIT -X main.BuildDate=$GIT_DATE" -o coordinator
# final stage
FROM $APP_BASE_IMAGE
RUN apt-get update && DEBIAN_FRONTEND=non-interactive apt-get -y install git python3-pip cmake wget libgtest-dev lcov git libtool automake clang-tidy build-essential
COPY controller-requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN mkdir /root/.ssh && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
WORKDIR /app
RUN git clone https://github.com/brendangregg/FlameGraph
COPY --from=build-env /src/cmd/coordinator/coordinator /app/
COPY --from=nodebuild /tmp/output/build /app/frontend
CMD ./coordinator