diff --git a/docker/README.md b/docker/README.md index 7465bd10f..f08ea1806 100644 --- a/docker/README.md +++ b/docker/README.md @@ -18,6 +18,10 @@ $ docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs # Use `docker start` if you have stopped it. $ docker start gogs + +# Or using docker-compose +$ POSTGRES_USER= POSTGRES_PASSWORD= docker-compose up -d + ``` Note: It is important to map the Gogs ssh service from the container to the host and set the appropriate SSH Port and URI settings when setting up Gogs for the first time. To access and clone Gogs Git repositories with the above configuration you would use: `git clone ssh://git@hostname:10022/username/myrepo.git` for example. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..f2e7b9703 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,37 @@ +version: '2' +services: + postgres: + image: postgres:9.5 + environment: + - "POSTGRES_USER=${POSTGRES_USER}" + - "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}" + - "POSTGRES_DB=gogs" + volumes: + - "db-data:/var/lib/postgresql/data" + networks: + - gogs + gogs: + image: gogs/gogs + ports: + - "10022:22" + - "3000:3000" + links: + - postgres + environment: + - "RUN_CROND=true" + networks: + - gogs + volumes: + - "gogs-data:/data" + depends_on: + - postgres + +networks: + gogs: + driver: bridge + +volumes: + db-data: + driver: local + gogs-data: + driver: local