首次提交:初始化项目
This commit is contained in:
32
010-中间件/003-navigation/Dockerfile
Normal file
32
010-中间件/003-navigation/Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
FROM python:3.11-alpine
|
||||
|
||||
# 安装 nginx
|
||||
RUN apk add --no-cache nginx
|
||||
|
||||
# 创建工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制生成器脚本
|
||||
COPY generator.py /app/
|
||||
COPY index.html /usr/share/nginx/html/
|
||||
|
||||
# 创建 nginx 配置
|
||||
RUN mkdir -p /run/nginx && \
|
||||
echo 'server {' > /etc/nginx/http.d/default.conf && \
|
||||
echo ' listen 80;' >> /etc/nginx/http.d/default.conf && \
|
||||
echo ' root /usr/share/nginx/html;' >> /etc/nginx/http.d/default.conf && \
|
||||
echo ' index index.html;' >> /etc/nginx/http.d/default.conf && \
|
||||
echo ' location / {' >> /etc/nginx/http.d/default.conf && \
|
||||
echo ' try_files $uri $uri/ =404;' >> /etc/nginx/http.d/default.conf && \
|
||||
echo ' }' >> /etc/nginx/http.d/default.conf && \
|
||||
echo '}' >> /etc/nginx/http.d/default.conf
|
||||
|
||||
# 启动脚本
|
||||
RUN echo '#!/bin/sh' > /app/start.sh && \
|
||||
echo 'nginx' >> /app/start.sh && \
|
||||
echo 'python3 /app/generator.py' >> /app/start.sh && \
|
||||
chmod +x /app/start.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/app/start.sh"]
|
||||
Reference in New Issue
Block a user