You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.3 KiB
YAML

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version: '3'
services:
postgres:
## for different postgres version, you could get more at here : https://hub.docker.com/_/postgres?tab=tags
image: "postgres:latest"
## port binding to 5432, you could change to 15432:5432 or any other available port you want
ports:
- "5432:5432"
container_name: shardingsphere-example-postgres
## you could access Postgres like `psql -d your_database_name -h 127.0.0.1 -U root -p 5432 -W`
environment:
- TZ=Asia/Shanghai
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
## copy the manual_schema.sql to /docker-entrypoint-initdb.d/ . this will init the sql file when the Postgres in container start up
volumes:
- ../../../src/resources/manual_schema.sql:/docker-entrypoint-initdb.d/manual_schema.sql
proxy:
## get more versions of proxy here : https://hub.docker.com/r/apache/shardingsphere-proxy/tags
image: "apache/shardingsphere-proxy:latest"
container_name: shardingsphere-example-proxy
depends_on:
- postgres
## wait-for-it.sh will make proxy entry point wait until Postgres container 5432 port open
entrypoint: >
/bin/sh -c "/opt/wait-for-it.sh shardingsphere-example-postgres:5432 --timeout=20 --strict --
&& /opt/shardingsphere-proxy/bin/start.sh 3308
&& tail -f /opt/shardingsphere-proxy/logs/stdout.log"
ports:
- "3308:3308"
links:
- "postgres:postgres"
volumes:
- ./conf/:/opt/shardingsphere-proxy/conf
- ../../tools/wait-for-it.sh:/opt/wait-for-it.sh
environment:
- JVM_OPTS="-Djava.awt.headless=true"