Small changes for a better docker-compose
This commit is contained in:
parent
d57f119c7a
commit
cbc3f0fe1f
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ node_modules
|
||||
build
|
||||
config.yml
|
||||
*.log
|
||||
docker/app.env
|
||||
docker/db.env
|
||||
|
2
Makefile
2
Makefile
@ -31,7 +31,7 @@ build_docker_image:
|
||||
cp -R sql/migration canapeapp/migrations
|
||||
cp $$GOPATH/bin/migrate canapeapp/migrate
|
||||
yarn build
|
||||
go build -v -o canapeapp/app src/main.go
|
||||
go build -v -o canapeapp/app src/*.go
|
||||
docker build --tag canapeapp:latest --file docker/Dockerfile-production .
|
||||
rm -rf canapeapp
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
FROM debian:8.7
|
||||
RUN apt update && apt upgrade -y && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY canapeapp /opt/canapeapp
|
||||
WORKDIR /opt/canapeapp
|
||||
|
4
docker/app.env.example
Normal file
4
docker/app.env.example
Normal file
@ -0,0 +1,4 @@
|
||||
CONFIG_FILE=/etc/canapeapp.yml
|
||||
DB_USER=w000t
|
||||
DB_PASS=bob
|
||||
DB_ENV=production
|
4
docker/db.env.example
Normal file
4
docker/db.env.example
Normal file
@ -0,0 +1,4 @@
|
||||
POSTGRES_PASSWORD=bob
|
||||
POSTGRES_USER=w000t
|
||||
POSTGRES_DB=production
|
||||
PGDATA=/var/lib/postgresql/data/pgdata
|
@ -1,40 +1,41 @@
|
||||
version: "3"
|
||||
|
||||
networks:
|
||||
canapeapp:
|
||||
external: false
|
||||
canapeapp:
|
||||
external: false
|
||||
|
||||
services:
|
||||
database:
|
||||
image: postgres:9.5
|
||||
container_name: canapeapp_database
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=test
|
||||
- POSTGRES_USER=test
|
||||
- POSTGRES_DB=production
|
||||
networks:
|
||||
- canapeapp
|
||||
# volumes:
|
||||
# - .:/docker-entrypoint-initdb.d/
|
||||
ports:
|
||||
- 5432
|
||||
app:
|
||||
image: canapeapp:latest
|
||||
container_name: canapeapp
|
||||
restart: always
|
||||
depends_on:
|
||||
- database
|
||||
environment:
|
||||
- CONFIG_FILE=/etc/canapeapp.yml
|
||||
- DB_USER=test
|
||||
- DB_PASS=test
|
||||
- DB_ENV=production
|
||||
networks:
|
||||
- canapeapp
|
||||
ports:
|
||||
- 127.0.0.1:6666:3000
|
||||
volumes:
|
||||
- ../config-prod.yml:/etc/canapeapp.yml:ro
|
||||
links:
|
||||
- database
|
||||
database:
|
||||
image: postgres:9.5
|
||||
container_name: canapeapp_database
|
||||
restart: always
|
||||
networks:
|
||||
- canapeapp
|
||||
volumes:
|
||||
- db-volume:/var/lib/postgresql/data/pgdata
|
||||
ports:
|
||||
- 127.0.0.1:5432:5432
|
||||
env_file:
|
||||
- ./db.env
|
||||
|
||||
app:
|
||||
image: canapeapp:latest
|
||||
container_name: canapeapp
|
||||
restart: always
|
||||
depends_on:
|
||||
- database
|
||||
networks:
|
||||
- canapeapp
|
||||
ports:
|
||||
- 127.0.0.1:3000:3000
|
||||
volumes:
|
||||
- ../config.yml:/etc/canapeapp.yml:ro
|
||||
- img-volume:/home/img
|
||||
links:
|
||||
- database
|
||||
env_file:
|
||||
- ./app.env
|
||||
|
||||
volumes:
|
||||
img-volume:
|
||||
db-volume:
|
||||
|
Loading…
x
Reference in New Issue
Block a user