diff --git a/Dockerfile b/Dockerfile index a814719..87bb10a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,10 @@ RUN apk --no-cache add gcc g++ make git WORKDIR /go/src/app COPY . . + RUN go get ./... RUN GOOS=linux go build -ldflags="-s -w" -o ./bin/vault-wrap ./vault.go + FROM alpine:3.20 RUN apk add tzdata #RUN apk --no-cache add ca-certificates diff --git a/docker-compose.yml b/docker-compose.yml index 0d38d20..146fcea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: environment: - ACTION_ADDRESS=${ACTION_ADDRESS} - VAULT_ADDRESS=${VAULT_ADDRESS} + - LISTEN_PORT=443 - TLS_KEY_FILE=${TLS_KEY_FILE} - TLS_CERT_FILE=${TLS_CERT_FILE} - TZ=Europe/Moscow @@ -22,6 +23,42 @@ services: max-size: "10m" max-file: "5" + traefik: + image: traefik:v3.0 + command: +# - --entrypoints.web.address=:80 +# - --entrypoints.web-secure.address=:443 +# - --providers.docker=true + - --providers.file.directory=/configuration/ + - --providers.file.watch=true + volumes: + - ./configuration/:/configuration/ + - ./traefik.yml:/traefik.yml:ro + - /var/run/docker.sock:/var/run/docker.sock:ro + - ./ssl/:/ssl/:ro + ports: + - 80:80 + - 8080:8080 + - 888:888 + - 443:443 + restart: always + networks: + - default + labels: + - "traefik.enable=true" + - "traefik.http.routers.traefik.entrypoints=https" + - "traefik.http.routers.traefik.rule=Host(`runner1-prod.corp.samsonopt.ru`)" + - "traefik.http.routers.traefik.tls=true" +# - "traefik.http.routers.traefik.tls.certresolver=letsEncrypt" + - "traefik.http.routers.traefik.service=api@internal" + - "traefik.http.services.traefik-traefik.loadbalancer.server.port=888" + +networks: + default: + name: reverse-proxy + external: true + + volumes: vault-wrap-log: vault-wrap-conf: diff --git a/entrypoint.sh b/entrypoint.sh index 2f0ae4f..099470f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,7 +2,7 @@ set -u while true ;do - /go/bin/vault-wrap -action-address "${ACTION_ADDRESS}" -vault-url "${VAULT_ADDRESS}" -tls-cert "/usr/local/share/vault-wrap/${TLS_CERT_FILE}" -tls-key "/usr/local/share/vault-wrap/${TLS_KEY_FILE}" -template-dir /usr/local/share/vault-wrap -log-file /var/log/vault-wrap/vault-wrap.log + /go/binv/ault-wrap -action-address "${ACTION_ADDRESS}" -vault-url "${VAULT_ADDRESS}" -tls-cert "/usr/local/share/vault-wrap/${TLS_CERT_FILE}" -tls-key "/usr/local/share/vault-wrap/${TLS_KEY_FILE}" -template-dir /usr/local/share/vault-wrap -log-file /var/log/vault-wrap/vault-wrap.log -listen-port "${LISTEN_PORT}" sleep 120 done diff --git a/html-template/index.html b/html-template/index.html index e4a773f..a777ff2 100644 --- a/html-template/index.html +++ b/html-template/index.html @@ -4,26 +4,29 @@
- Расшифровать | - Сгенерировать пароль + |
- |