feat: _template
This commit is contained in:
parent
c0f4cee68f
commit
e28b7c8ed9
5
_template/.env
Normal file
5
_template/.env
Normal file
@ -0,0 +1,5 @@
|
||||
BASE_URL=subdomain.
|
||||
EMAIL=
|
||||
|
||||
PUID=1000
|
||||
PGID=1000
|
21
_template/Dockerfile
Normal file
21
_template/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM docker.io/debian:12-slim as base
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
WORKDIR /app/
|
||||
|
||||
FROM base as build
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
ARG APP="http://app.com/download"
|
||||
RUN curl -L "$APP" | tar xz --strip-components=1
|
||||
|
||||
FROM base
|
||||
COPY --from=build /app/ .
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
RUN useradd -m app
|
||||
VOLUME /config/
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
CMD ["./app"]
|
37
_template/compose.yaml
Normal file
37
_template/compose.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
services:
|
||||
install_site:
|
||||
build: install_site
|
||||
environment:
|
||||
- BASE_URL
|
||||
- EMAIL
|
||||
volumes:
|
||||
- ./nginx.conf:/web/app.conf
|
||||
- sites:/sites/
|
||||
- certs:/etc/letsencrypt/
|
||||
- certbotroot:/var/www/certbot/
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
app:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- PUID
|
||||
- PGID
|
||||
volumes:
|
||||
- config:/config/
|
||||
networks:
|
||||
- nginx
|
||||
|
||||
volumes:
|
||||
sites:
|
||||
external: true
|
||||
certs:
|
||||
external: true
|
||||
certbotroot:
|
||||
external: true
|
||||
config:
|
||||
|
||||
networks:
|
||||
nginx:
|
||||
external: true
|
13
_template/entrypoint.sh
Executable file
13
_template/entrypoint.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -n "$PGID" ]; then
|
||||
groupmod -g "$PGID" app
|
||||
fi
|
||||
|
||||
if [ -n "$PUID" ]; then
|
||||
usermod -u "$PUID" app
|
||||
fi
|
||||
|
||||
chown -R app:app /config/
|
||||
|
||||
exec su app -c "$*"
|
1
_template/install_site
Symbolic link
1
_template/install_site
Symbolic link
@ -0,0 +1 @@
|
||||
../_nginx/install_site
|
23
_template/nginx.conf
Normal file
23
_template/nginx.conf
Normal file
@ -0,0 +1,23 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name $BASE_URL;
|
||||
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name $BASE_URL;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/$BASE_URL/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/$BASE_URL/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://app;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user