-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (36 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
44 lines (36 loc) · 1.42 KB
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
FROM node:10 as DevContainer
ENV DEBIAN_FRONTEND=noninteractive
COPY . /workspaces/fe-docker-starter
# Configure apt and install packagess
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
#
# Verify git and needed tools are installed
&& apt-get install -y git procps \
#
# Remove outdated yarn from /opt and install via package
# so it can be easily updated via apt-get upgrade yarn
&& rm -rf /opt/yarn-* \
&& rm -f /usr/local/bin/yarn \
&& rm -f /usr/local/bin/yarnpkg \
&& apt-get install -y curl apt-transport-https lsb-release \
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends yarn \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& cd /workspaces/fe-docker-starter \
&& yarn \
&& yarn build
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog
# 构建输出线上镜像
FROM nginx:alpine as Nginx
COPY web-nginx.conf /etc/nginx/conf.d/
COPY --from=DevContainer /workspaces/fe-docker-starter/dist /srv/web/
CMD ["nginx", "-g", "daemon off;"]
EXPOSE 8080