All checks were successful
Build Docker Images / build (map[app_version:v2.0 buggy:false tag:v2.0]) (push) Successful in 1m11s
Build Docker Images / build (map[app_version:v1.0 buggy:false tag:v1.0]) (push) Successful in 1m40s
Build Docker Images / build (map[app_version:v2.1 buggy:false tag:v2.1]) (push) Successful in 1m7s
Build Docker Images / build (map[app_version:v3.0-buggy buggy:true tag:v3.0-buggy]) (push) Successful in 1m47s
30 lines
627 B
Docker
30 lines
627 B
Docker
FROM python:3.9-alpine
|
||
|
||
# 构建参数
|
||
ARG APP_VERSION=v1.0
|
||
ARG BUGGY=false
|
||
|
||
# 设置时区
|
||
RUN apk add --no-cache tzdata && \
|
||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||
echo "Asia/Shanghai" > /etc/timezone
|
||
|
||
ENV TZ=Asia/Shanghai \
|
||
APP_VERSION=${APP_VERSION} \
|
||
BUGGY=${BUGGY}
|
||
|
||
WORKDIR /app
|
||
|
||
COPY requirements.txt .
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
COPY app.py .
|
||
|
||
EXPOSE 80
|
||
|
||
# 添加健康检查(v2.0+ 特性)
|
||
HEALTHCHECK --interval=10s --timeout=3s --start-period=30s --retries=3 \
|
||
CMD wget -q --spider http://127.0.0.1:80/health 2>&1 || exit 1
|
||
|
||
CMD ["python", "app.py"]
|