Files
user-management/.devcontainer/docker-compose.yml
T
hurui200320 cdde6ec922
Unit test coverage / gradle-test (pull_request) Successful in 6m16s
Unit test coverage / gradle-test (push) Successful in 6m2s
CI for publishing docker image / build-and-publish (push) Successful in 5m59s
feat:add dev container
2025-08-14 16:24:02 +08:00

82 lines
2.4 KiB
YAML

version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
volumes:
# Forwards the local Docker socket to the container.
- /var/run/docker.sock:/var/run/docker-host.sock
# Update this to wherever you want VS Code to mount the folder of your project
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
entrypoint: /usr/local/share/docker-init.sh
command: sleep infinity
# Uncomment the next four lines if you will use a ptrace-based debuggers like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
depends_on:
- rabbitmq
- consul
- keycloak
rabbitmq:
image: rabbitmq:4-management
hostname: "my-rabbit"
environment:
RABBITMQ_DEFAULT_USER: springuser
RABBITMQ_DEFAULT_PASS: TheCleverWho
volumes:
- "rabbitmq-data:/var/lib/rabbitmq"
consul:
image: hashicorp/consul:1.20
command:
- "agent"
- "-data-dir=/consul/data"
- "-config-file=/config/config.hcl"
environment:
- CONSUL_BIND_INTERFACE=eth0
volumes:
- "consul-data:/consul/data"
- "./consul-main-config.hcl:/config/config.hcl"
keycloak:
image: "quay.io/keycloak/keycloak:26.2.5"
networks:
default:
aliases:
- "keycloak.dev.localhost"
environment:
- KC_BOOTSTRAP_ADMIN_USERNAME=admin
- KC_BOOTSTRAP_ADMIN_PASSWORD=admin
- KC_HOSTNAME=http://keycloak.dev.localhost:8000
- KC_HOSTNAME_ADMIN=http://keycloak.dev.localhost:8000
- KC_HTTP_PORT=8000
command:
- start
# enable http, let reverse proxy handles the TLS
- --http-enabled=true
# take X-Forwarded-* headers from reverse proxy
- --proxy-headers=xforwarded
# hide node name in cookie for sticky session, we're using reverse proxy for that
# ref: https://www.keycloak.org/server/reverseproxy#_enable_sticky_sessions
- --spi-sticky-session-encoder-infinispan-should-attach-route=false
# read hostname from reverse proxy headers
- --hostname-strict=false
# Limit the request queue to prevent OOM
- --http-max-queued-requests=200
volumes:
rabbitmq-data:
consul-data: