我正在尝试在docker上运行Spring应用程序。它运作良好,除了我不知道如何为Spring生成pk12以及在letencrypt-nginx-proxy-companion自动续订证书时如何自动生成。
我一直在寻找添加要运行的命令的地方,但是我的想法用光了
我尝试将PFX_EXPORT_PASSPHRASE和PFX_EXPORT:“ true”环境变量添加到letsencrypt容器中,但没有发现任何区别
我的docker-compose
version: '3.7'
services:
backend:
container_name: spring
image: openjdk:8-jre
depends_on:
- app-db
- config
expose:
- 8080
volumes:
- ./backend/web/target:/app
- nginx_certs:/etc/nginx/certs:ro
environment:
- VIRTUAL_PORT=8080
- VIRTUAL_HOST=${BACKEND_VIRTUAL_HOST}
- LETSENCRYPT_HOST=${BACKEND_LETSENCRYPT_HOST}
command: sh -c 'ls /app && java -Xmx11244m -Xms1024m -Dspring.profiles.active=local -Dcom.sun.management.jmxremote -jar /app/web.jar'
networks:
- main
frontend:
container_name: python
image: python:3-alpine
expose:
- 5001
volumes:
- ./frontend:/app
- nginx_certs:/etc/nginx/certs:ro
environment:
- VIRTUAL_PORT=5001
- VIRTUAL_HOST=${FRONT_VIRTUAL_HOST}
- LETSENCRYPT_HOST=${FRONT_LETSENCRYPT_HOST}
command: sh -c 'pip install --no-cache-dir -r /app/requirements.txt && python /app/application.py'
depends_on:
- config
networks:
- main
nginx-proxy:
image: nginx:alpine
container_name: nginx-proxy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- nginx_conf:/etc/nginx/conf.d
- nginx_vhost:/etc/nginx/vhost.d
- nginx_html:/usr/share/nginx/html
- nginx_certs:/etc/nginx/certs:ro
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
networks:
- main
docker-gen:
image: jwilder/docker-gen
container_name: nginx-proxy-gen
command: sh -c 'ls etc/nginx/certs && -notify-sighup nginx-proxy -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf'
restart: always
volumes:
- nginx_conf:/etc/nginx/conf.d
- nginx_vhost:/etc/nginx/vhost.d
- nginx_html:/usr/share/nginx/html
- nginx_certs:/etc/nginx/certs:ro
- nginx_htpasswd:/etc/nginx/htpasswd:ro
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen: "true"
depends_on:
- nginx-proxy
networks:
- main
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-proxy-le
restart: always
volumes:
- nginx_conf:/etc/nginx/conf.d
- nginx_vhost:/etc/nginx/vhost.d
- nginx_html:/usr/share/nginx/html
- nginx_certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
NGINX_DOCKER_GEN_CONTAINER: docker-gen
NGINX_PROXY_CONTAINER: nginx-proxy
depends_on:
- docker-gen
- nginx-proxy
networks:
- main
volumes:
nginx_conf:
nginx_vhost:
nginx_html:
nginx_certs:
nginx_htpasswd:
networks:
main: