summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Kohl <git@jonaskohl.de>2024-09-19 19:33:12 +0200
committerJonas Kohl <git@jonaskohl.de>2024-09-19 19:33:12 +0200
commit2fbe9ad343e82679ba0573a7daa510cfbe488ddf (patch)
tree9b84737a765e510c87193f93aa8a34fea37e3298
parent75e9b62da57eb7ce3f9e8a8667a7de59188c221f (diff)
Docker dev and prod separation
-rw-r--r--.env.example2
-rw-r--r--Dockerfile6
-rw-r--r--compose.dev.yml18
-rw-r--r--compose.yml20
4 files changed, 28 insertions, 18 deletions
diff --git a/.env.example b/.env.example
index 7682611..af9a15b 100644
--- a/.env.example
+++ b/.env.example
@@ -5,6 +5,8 @@ POSTGRES_PASSWORD=postgres
MAILER_DSN=
MAILER_FROM=
PUBLIC_URL=
+PGADMIN_EMAIL=
+PGADMIN_PASSWORD=
#MYSTIC_FORUM_THEME=default
#REGISTRATION_ENABLED=1
#MYSTIC_FORUM_TITLE=
diff --git a/Dockerfile b/Dockerfile
index abd5d04..ccbf6e7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,8 +21,10 @@ RUN docker-php-ext-configure gd \
RUN docker-php-ext-install gd zip pgsql intl
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
-FROM base
+FROM base AS dev
COPY ./000-default.conf /etc/apache2/sites-available/000-default.conf
-COPY ./src /var/www/html
WORKDIR /var/www/html
+
+FROM dev AS prod
+COPY ./src /var/www/html
RUN composer install
diff --git a/compose.dev.yml b/compose.dev.yml
new file mode 100644
index 0000000..4028ddc
--- /dev/null
+++ b/compose.dev.yml
@@ -0,0 +1,18 @@
+services:
+ app:
+ build:
+ context: ./
+ target: dev
+ restart: unless-stopped
+ volumes:
+ - "./src/:/var/www/html/:ro"
+ admin:
+ image: dpage/pgadmin4:latest
+ restart: unless-stopped
+ depends_on:
+ - db
+ ports:
+ - 127.0.0.1:8314:80
+ environment:
+ PGADMIN_DEFAULT_EMAIL: '${PGADMIN_EMAIL}'
+ PGADMIN_DEFAULT_PASSWORD: '${PGADMIN_PASSWORD}'
diff --git a/compose.yml b/compose.yml
index 78349a1..7b68e2e 100644
--- a/compose.yml
+++ b/compose.yml
@@ -1,29 +1,17 @@
services:
app:
- build: .
+ build:
+ context: ./
+ target: prod
restart: unless-stopped
env_file: ./.env
depends_on:
- db
ports:
- - 8313:80
- # volumes:
- # - "./src/:/var/www/html/:ro"
+ - 127.0.0.1:8313:80
db:
image: postgres
restart: unless-stopped
env_file: ./.env
- # ports:
- # - 5432:5432
volumes:
- ./data/db:/var/lib/postgresql/data
- # admin:
- # image: dpage/pgadmin4:latest
- # restart: unless-stopped
- # depends_on:
- # - db
- # ports:
- # - 8314:80
- # environment:
- # PGADMIN_DEFAULT_EMAIL: 'pgadmin@jonaskohl.de'
- # PGADMIN_DEFAULT_PASSWORD: 'admin'