-
Notifications
You must be signed in to change notification settings - Fork 3
/
dockerfile-vprix-core
120 lines (86 loc) · 3.44 KB
/
dockerfile-vprix-core
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
ARG BASE_IMAGE="ubuntu:20.04"
# clone agent
FROM alpine/git:latest as agent_git
WORKDIR /vprix
RUN git clone https://github.com/vprix/agent.git
# build agent
FROM golang:1.18 as agent
ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.com.cn,direct
WORKDIR /go/release
COPY --from=agent_git /vprix/agent ./
RUN go mod tidy && \
go install github.com/gobuffalo/packr/v2/packr2@latest && \
packr2 -v && \
go build -ldflags '-s -w' -o agent
# build core system
FROM ${BASE_IMAGE} AS install_tools
LABEL "org.opencontainers.image.authors"='vprix team "[email protected]"'
LABEL "com.vprix.image"="true"
ARG START_XFCE4=0
ARG BG_IMG=bg_vprix.jpg
ARG DISTRO=ubuntu
ARG LANG='en_US.UTF-8'
ARG LANGUAGE='en_US:en'
ENV DISPLAY=:0 \
VPRIX_PORT=8080 \
VPRIX_USER="vprix-user" \
VPRIX_AGENT_PATH=/usr/share/vprix_agent \
HOME=/home/vprix-user \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/dockerstartup/install \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PASSWORD=vprix.com \
VNC_OPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7 -DLP_ClipDelay=0" \
SHELL=/bin/bash \
START_XFCE4=$START_XFCE4 \
LANG=$LANG \
LANGUAGE=$LANGUAGE
EXPOSE $VPRIX_PORT
WORKDIR $HOME
RUN mkdir -p $HOME/Desktop
# 安装基础依赖
COPY ./src/ubuntu/install/tools $INST_SCRIPTS/tools/
## 正式编译的逻辑
RUN bash $INST_SCRIPTS/tools/install_tools.sh && rm -rf $INST_SCRIPTS/tools/
### 安装自定义字体
COPY ./src/ubuntu/install/fonts $INST_SCRIPTS/fonts/
RUN bash $INST_SCRIPTS/fonts/install_custom_fonts.sh && rm -rf $INST_SCRIPTS/fonts/
#### 安装自定义鼠标指针
COPY ./src/ubuntu/install/cursors $INST_SCRIPTS/cursors/
RUN bash $INST_SCRIPTS/cursors/install_cursors.sh && rm -rf $INST_SCRIPTS/cursors/
### 安装 xfce UI
COPY ./src/ubuntu/install/xfce $INST_SCRIPTS/xfce/
## 正式编译的逻辑
RUN bash $INST_SCRIPTS/xfce/install_xfce_ui.sh && rm -rf $INST_SCRIPTS/xfce/
### 安装tigervnc组件
COPY ./src/ubuntu/install/tiger_vnc $INST_SCRIPTS/tiger_vnc/
## 正式编译的逻辑
RUN bash $INST_SCRIPTS/tiger_vnc/install_tiger_vnc.sh && rm -rf $INST_SCRIPTS/tiger_vnc/
### Setup Container User - Libnss Wrapper
COPY ./src/ubuntu/install/libnss $INST_SCRIPTS/libnss/
RUN bash $INST_SCRIPTS/libnss/libnss_wrapper.sh && rm -rf $INST_SCRIPTS/libnss/
### configure startup
ADD ./src/common/startup_scripts $STARTUPDIR
RUN bash $STARTUPDIR/set_user_permission.sh $STARTUPDIR $HOME
# 安装窗口脚本
COPY ./src/ubuntu/install/maximize_script $STARTUPDIR/
### 设置ui的配置信息和背景图
ADD ./src/$DISTRO/xfce/.config/ $HOME/.config/
RUN mkdir -p /usr/share/extra/backgrounds/
RUN mkdir -p /usr/share/extra/icons/
ADD ./src/common/resources/images/bg_vprix.jpg /usr/share/extra/backgrounds/bg_vprix.jpg
ADD ./src/common/resources/images/$BG_IMG /usr/share/extra/backgrounds/bg_default.jpg
ADD ./src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_ubuntu.png
ADD ./src/common/resources/images/icon_vprix.png /usr/share/extra/icons/icon_vprix.png
ADD ./src/common/resources/images/icon_vprix.png /usr/share/extra/icons/icon_default.png
### 安装vprix agent
COPY --from=agent /go/release/agent $VPRIX_AGENT_PATH/
### 创建运行时用户
RUN (groupadd -g 1000 $VPRIX_USER \
&& useradd -M -u 1000 -g 1000 $VPRIX_USER \
&& usermod -a -G $VPRIX_USER $VPRIX_USER) ; exit 0
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
USER 1000
ENTRYPOINT ["/usr/share/vprix_agent/agent","--debug"]