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
|
build
|
||||||
config.yml
|
config.yml
|
||||||
*.log
|
*.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 -R sql/migration canapeapp/migrations
|
||||||
cp $$GOPATH/bin/migrate canapeapp/migrate
|
cp $$GOPATH/bin/migrate canapeapp/migrate
|
||||||
yarn build
|
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 .
|
docker build --tag canapeapp:latest --file docker/Dockerfile-production .
|
||||||
rm -rf canapeapp
|
rm -rf canapeapp
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
FROM debian:8.7
|
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
|
COPY canapeapp /opt/canapeapp
|
||||||
WORKDIR /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
|
@ -9,32 +9,33 @@ services:
|
|||||||
image: postgres:9.5
|
image: postgres:9.5
|
||||||
container_name: canapeapp_database
|
container_name: canapeapp_database
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
|
||||||
- POSTGRES_PASSWORD=test
|
|
||||||
- POSTGRES_USER=test
|
|
||||||
- POSTGRES_DB=production
|
|
||||||
networks:
|
networks:
|
||||||
- canapeapp
|
- canapeapp
|
||||||
# volumes:
|
volumes:
|
||||||
# - .:/docker-entrypoint-initdb.d/
|
- db-volume:/var/lib/postgresql/data/pgdata
|
||||||
ports:
|
ports:
|
||||||
- 5432
|
- 127.0.0.1:5432:5432
|
||||||
|
env_file:
|
||||||
|
- ./db.env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: canapeapp:latest
|
image: canapeapp:latest
|
||||||
container_name: canapeapp
|
container_name: canapeapp
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
environment:
|
|
||||||
- CONFIG_FILE=/etc/canapeapp.yml
|
|
||||||
- DB_USER=test
|
|
||||||
- DB_PASS=test
|
|
||||||
- DB_ENV=production
|
|
||||||
networks:
|
networks:
|
||||||
- canapeapp
|
- canapeapp
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:6666:3000
|
- 127.0.0.1:3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- ../config-prod.yml:/etc/canapeapp.yml:ro
|
- ../config.yml:/etc/canapeapp.yml:ro
|
||||||
|
- img-volume:/home/img
|
||||||
links:
|
links:
|
||||||
- database
|
- database
|
||||||
|
env_file:
|
||||||
|
- ./app.env
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
img-volume:
|
||||||
|
db-volume:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user