-
Notifications
You must be signed in to change notification settings - Fork 59
/
Dockerfile_front_from_src
38 lines (31 loc) · 1.23 KB
/
Dockerfile_front_from_src
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
FROM ubuntu:18.04
ENV API_BASE_URL=${API_BASE_URL}
COPY src/front/ /front/
COPY nginx.site.default.conf /
COPY entrypoint_front.sh /
RUN cd / && \
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
apt update && \
apt upgrade -y && \
apt-get install -y nginx && \
apt-get install -y git && \
apt-get install -y wget && \
apt-get install -y xz-utils && \
apt-get clean && apt-get autoclean && \
wget https://nodejs.org/dist/v16.16.0/node-v16.16.0-linux-x64.tar.xz && \
tar xf node-v16.16.0-linux-x64.tar.xz && \
rm -rf node-v16.16.0-linux-x64.tar.xz && \
ln -s /node-v16.16.0-linux-x64/bin/npm /usr/local/bin/ && \
ln -s /node-v16.16.0-linux-x64/bin/node /usr/local/bin/ && \
npm config set registry https://registry.npm.taobao.org && \
git config --global url."https://".insteadOf git://
RUN cd /front && \
npm install && \
npm run build:prod && \
rm -rf /var/www/html/* && \
mv /front/dist/* /var/www/html/
RUN mv /nginx.site.default.conf /etc/nginx/sites-enabled/default && \
chmod +x /entrypoint_front.sh
EXPOSE 80
ENTRYPOINT [ "/entrypoint_front.sh" ]