Skip to content

Commit

Permalink
add ACME
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed Mar 8, 2024
1 parent 6cc4a2f commit cfd9f05
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ doas podman run --name ii -it monius/docker-instant-ai /bin/sh
doas podman run --name ii -p 80:80 -p 443:443 -it monius/docker-instant-ai /bin/sh
doas podman run --name ii -p 80:80 -p 443:443 -itd monius/docker-instant-ai

doas podman run -itd \
--name instant-ai \
-e DOMAIN=domain \
-e CLOUDFLARE_DNS_API_TOKEN=cf_api_token \
-e AI_SERVICE_NAME=ai_name \
-e AI_SERVICE_PORT=ai_port \
-p 80:80 \
-p 443:443 \
monius/docker-instant-ai

doas podman rm -f $(doas podman ps -a -q)
doas podman rmi -f $(doas podman images -a -q)
```
8 changes: 7 additions & 1 deletion dev/BASE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL maintainer="M0nius <[email protected]>" \
ENV XUSER="nginx"
ENV VER="1.25.3"
ENV NGINX_SRC="https://nginx.org/download/nginx-${VER}.tar.gz"
ENV PKG="build-base linux-headers openssl-dev pcre-dev curl zlib-dev"
ENV PKG="build-base linux-headers openssl-dev pcre-dev curl zlib-dev git go"

RUN \
apk --no-cache add ${PKG} && \
Expand Down Expand Up @@ -47,12 +47,18 @@ RUN \
--with-http_v2_module && \
make -j"$(nproc)" && make install

RUN \
git clone --depth 1 --branch master https://github.com/go-acme/lego.git && \
cd lego && make build && \
mv dist/lego /usr/sbin

FROM alpine:3.19
ENV XUSER nginx

RUN apk --no-cache add ca-certificates openssl pcre zlib tzdata git

COPY --from=NGINX /usr/sbin/nginx /usr/sbin/nginx
COPY --from=NGINX /usr/sbin/lego /usr/sbin/lego

RUN addgroup -S ${XUSER} && \
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G ${XUSER} ${XUSER}
Expand Down
22 changes: 14 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@ mkdir -p /etc/nginx/html
mkdir -p /etc/nginx/ssl

cat <<EOF | tee /etc/nginx/nginx.conf
daemon off;
worker_processes 1;
worker_processes auto;
error_log stderr notice;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
charset utf-8;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
Expand Down

0 comments on commit cfd9f05

Please sign in to comment.