Skip to content

Commit 32c8de1

Browse files
committed
基于nginx官方镜像制作自带httpsok自动续签的镜像
1 parent e8be2b1 commit 32c8de1

5 files changed

Lines changed: 92 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
22
.DS_Store
3+
.env

docker/nginx/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM nginx:1.28.0
2+
3+
LABEL maintainer="httpsok.com" \
4+
description="Nginx with HTTPSOK integration" \
5+
version="1.28.0"
6+
7+
ENV HTTPSOK_TOKEN=""
8+
9+
RUN apt-get update && \
10+
apt-get install --no-install-recommends -y cron procps && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
COPY entrypoint.sh /entrypoint.sh
14+
15+
RUN chmod +x /entrypoint.sh
16+
17+
ENTRYPOINT ["/entrypoint.sh"]
18+
19+
EXPOSE 80
20+
21+
STOPSIGNAL SIGQUIT
22+
23+
CMD ["nginx", "-g", "daemon off;"]

docker/nginx/Dockerfile-alpine

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
FROM nginx:1.29.1-alpine
1+
FROM nginx:1.28.0-alpine
22

33
LABEL maintainer="httpsok.com" \
44
description="Nginx with HTTPSOK integration" \
5-
version="1.29.1"
5+
version="1.28.0"
66

77
ENV HTTPSOK_TOKEN=""
88

9-
RUN apk update && apk add --no-cache --virtual .runtime-deps bash && rm -rf /var/cache/apk/*
9+
RUN apk update && \
10+
apk add --no-cache --virtual .runtime-deps bash && \
11+
rm -rf /var/cache/apk/*
1012

1113
COPY entrypoint.sh /entrypoint.sh
1214

docker/nginx/buildx.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/zsh
2+
3+
cd `dirname $0` && pwd
4+
5+
echo '开始构建镜像'
6+
7+
docker buildx build --platform linux/amd64,linux/arm64 -t httpsok/nginx:1.28.0-alpine --push -f Dockerfile-alpine .
8+
docker buildx build --platform linux/amd64,linux/arm64 -t httpsok/nginx:1.28.0 --push -f Dockerfile .
9+
10+
# 本地构建镜像并且测试
11+
#COMPOSE_BAKE=true docker-compose build httpsok-nginx-alpine
12+

docker/nginx/compose.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
services:
2+
3+
httpsok-nginx-alpine:
4+
# 构建
5+
build:
6+
context: .
7+
dockerfile: Dockerfile-alpine
8+
# 设置容器名称
9+
container_name: httpsok-nginx-alpine
10+
# 镜像
11+
image: httpsok/nginx:1.28.0-alpine
12+
# 端口
13+
ports:
14+
- "80:80"
15+
- "443:443"
16+
# 挂载
17+
volumes:
18+
- ./conf.d:/etc/nginx/conf.d
19+
- ./html:/var/html/
20+
- ./certs:/etc/nginx/certs
21+
# 环境变量
22+
environment:
23+
# 设置时区为东八区
24+
- TZ=Asia/Shanghai
25+
# 设置TOKEN,从httpsok.com 控制台获取
26+
# - HTTPSOK_TOKEN=
27+
28+
httpsok-nginx:
29+
# 构建
30+
build:
31+
context: .
32+
dockerfile: Dockerfile
33+
# 设置容器名称
34+
container_name: httpsok-nginx
35+
# 镜像
36+
image: httpsok/nginx:1.28.0
37+
# 端口
38+
ports:
39+
- "80:80"
40+
- "443:443"
41+
# 挂载
42+
volumes:
43+
- ./conf.d:/etc/nginx/conf.d
44+
- ./html:/var/html/
45+
- ./certs:/etc/nginx/certs
46+
# 环境变量
47+
environment:
48+
# 设置时区为东八区
49+
- TZ=Asia/Shanghai
50+
# 设置TOKEN,从httpsok.com 控制台获取
51+
# - HTTPSOK_TOKEN=

0 commit comments

Comments
 (0)