forked from mjxu96/carlaviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (47 loc) · 1.85 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Frontend build stage
FROM node:12-alpine AS frontend
COPY ./frontend /home/carla/carlaviz/frontend
RUN apk --no-cache add git
WORKDIR /home/carla/carlaviz/frontend
RUN yarn && yarn build
# Backend build stage
FROM ubuntu:18.04 AS backend
COPY ./backend /home/carla/carlaviz/backend
RUN apt update && \
apt install -y wget autoconf automake libtool curl make g++ unzip
# install protobuf for xviz
WORKDIR /home/carla/protoc
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protobuf-cpp-3.11.2.tar.gz && \
tar xvzf protobuf-cpp-3.11.2.tar.gz && \
cd protobuf-3.11.2 && \
./configure && \
make -j12 && \
make install && \
ldconfig
# non-interactive setting for tzdata
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y git build-essential gcc-7 cmake libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl wget unzip autoconf libtool rsync
# build carlaviz backend
WORKDIR /home/carla/carlaviz/backend
RUN bash ./setup/setup.sh
WORKDIR /home/carla/carlaviz/backend/build
RUN cmake ../ && make backend -j`nproc --all`
# Release stage
FROM nginx:1.20
# frontend
COPY --from=frontend /home/carla/carlaviz/frontend/dist/ /var/www/carlaviz/
COPY --from=frontend /home/carla/carlaviz/frontend/index.html /var/www/carlaviz/index.html
COPY ./docker/carlaviz /etc/nginx/conf.d/default.conf
# backend
COPY --from=backend /home/carla/carlaviz/backend/bin/backend /home/carla/carlaviz/backend/bin/backend
COPY --from=backend /home/carla/protoc/protobuf-3.11.2/src/.libs/libprotobuf.so.22 /lib/x86_64-linux-gnu/libprotobuf.so.22
COPY ./docker/run.sh /home/carla/carlaviz/docker/run.sh
EXPOSE 8080-8081
EXPOSE 8089
ENV CARLAVIZ_BACKEND_HOST localhost
ENV CARLAVIZ_BACKEND_PORT 8081
ENV CARLA_SERVER_HOST localhost
ENV CARLA_SERVER_PORT 2000
WORKDIR /home/carla/carlaviz
ENTRYPOINT ["/bin/bash", "./docker/run.sh"]