Skip to content

Commit

Permalink
Merge pull request #5 from varchugov/add-compose
Browse files Browse the repository at this point in the history
add common docker-compose file for both front and back
  • Loading branch information
samnix-p committed Apr 2, 2021
2 parents 89d03ac + c34c97e commit 26a7e60
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
back/target/
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Run dev env
1. Install Docker and docker-compose
2. run this command (from project root):
```console
docker-compose up -d
```
3. To clear the env run:
```console
docker-compose down
```
19 changes: 17 additions & 2 deletions back/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2.2"
version: '3'

services:
postgres:
Expand All @@ -18,4 +18,19 @@ services:
timeout: 5s
retries: 5

# add backend service here, built from Dockerfile
back:
image: maven:3.6.3-jdk-11
restart: always
working_dir: /mnt/app
command: mvn install exec:java
volumes:
- gowork-back-maven-repo:/root/.m2
- .:/mnt/app:Z
ports:
- "8080:8080"
links:
- postgres
depends_on:
- postgres
volumes:
gowork-back-maven-repo:
44 changes: 44 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3'

services:
postgres:
image: postgres:13.2-alpine
restart: always
volumes:
- ./back/migrations/:/docker-entrypoint-initdb.d/
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: hh
POSTGRES_DB: hh
POSTGRES_USER: hh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U hh"]
interval: 10s
timeout: 5s
retries: 5

back:
image: maven:3.6.3-jdk-11
restart: always
working_dir: /mnt/app
command: mvn install exec:java
volumes:
- gowork-back-maven-repo:/root/.m2
- ./back:/mnt/app:Z
ports:
- "8080:8080"
links:
- postgres
depends_on:
- postgres
front:
build: ./front
ports:
- "3000:80"
links:
- back
depends_on:
- back
volumes:
gowork-back-maven-repo:

0 comments on commit 26a7e60

Please sign in to comment.