Spaces:
Sleeping
Sleeping
silencewing
commited on
Commit
•
978bce4
1
Parent(s):
ab36501
Update Dockerfile
Browse files- Dockerfile +15 -1
Dockerfile
CHANGED
@@ -6,9 +6,23 @@ FROM ubuntu:latest
|
|
6 |
|
7 |
# RUN apt-get install -y nginx
|
8 |
# 以上执行会创建 3 层镜像。可简化为以下格式:
|
|
|
9 |
RUN apt-get update && apt-get install -y vim && apt-get install -y nginx
|
10 |
# 如上,以 && 符号连接命令,这样执行后,只会创建 1 层镜像。
|
11 |
#指定运行该镜像的容器使用的端口为 80
|
12 |
# docker run的时候 一定要加上 -P
|
13 |
-
EXPOSE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
CMD ["nginx","-g","daemon off;"]
|
|
|
6 |
|
7 |
# RUN apt-get install -y nginx
|
8 |
# 以上执行会创建 3 层镜像。可简化为以下格式:
|
9 |
+
|
10 |
RUN apt-get update && apt-get install -y vim && apt-get install -y nginx
|
11 |
# 如上,以 && 符号连接命令,这样执行后,只会创建 1 层镜像。
|
12 |
#指定运行该镜像的容器使用的端口为 80
|
13 |
# docker run的时候 一定要加上 -P
|
14 |
+
EXPOSE 8080
|
15 |
+
|
16 |
+
|
17 |
+
RUN useradd -m -u 1000 user
|
18 |
+
# Switch to the "user" user
|
19 |
+
USER user
|
20 |
+
# Set home to the user's home directory
|
21 |
+
ENV HOME=/home/user \
|
22 |
+
PATH=/home/user/.local/bin:$PATH
|
23 |
+
# Set the working directory to the user's home directory
|
24 |
+
WORKDIR $HOME
|
25 |
+
RUN sudo mkdir /usr/share/nginx/html/app
|
26 |
+
RUN sudo chown usr /usr/share/nginx/html/app
|
27 |
+
|
28 |
CMD ["nginx","-g","daemon off;"]
|