Skip to content

Commit

Permalink
feat(db): add postgres container
Browse files Browse the repository at this point in the history
Refs: DL-T-51
  • Loading branch information
varrcan committed Sep 1, 2023
1 parent dd42645 commit f0ab0b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config-files/docker-compose-pgsql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.9"

services:
postgres:
container_name: ${HOST_NAME}_pgsql
image: postgres:${POSTGRES_VERSION:-15}
environment:
- "POSTGRES_DB=${POSTGRES_DB:-db}"
- "POSTGRES_USER=${POSTGRES_USER:-db}"
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-db}"
- "PGDATA=${PGDATA:-/var/lib/postgresql/data/pgdata}"
volumes:
- "${PWD}/.docker/volume/pg/:/var/lib/postgresql/data/:delegated"
4 changes: 4 additions & 0 deletions project/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func setComposeFiles() {

images := map[string]string{
"mysql": templateDir + "/docker-compose-mysql.yaml",
"pgsql": templateDir + "/docker-compose-pgsql.yaml",
"fpm": templateDir + "/docker-compose-fpm.yaml",
"apache": templateDir + "/docker-compose-apache.yaml",
"redis": templateDir + "/docker-compose-redis.yaml",
Expand All @@ -128,6 +129,9 @@ func setComposeFiles() {
if Env.GetFloat64("MYSQL_VERSION") > 0 {
files = append(files, images["mysql"])
}
if Env.GetFloat64("POSTGRES_VERSION") > 0 {
files = append(files, images["pgsql"])
}
if Env.GetBool("REDIS") {
files = append(files, images["redis"])
}
Expand Down

0 comments on commit f0ab0b4

Please sign in to comment.