diff options
| author | Jonas Kohl | 2024-09-19 19:33:12 +0200 | 
|---|---|---|
| committer | Jonas Kohl | 2024-09-19 19:33:12 +0200 | 
| commit | 2fbe9ad343e82679ba0573a7daa510cfbe488ddf (patch) | |
| tree | 9b84737a765e510c87193f93aa8a34fea37e3298 | |
| parent | 75e9b62da57eb7ce3f9e8a8667a7de59188c221f (diff) | |
Docker dev and prod separation
| -rw-r--r-- | .env.example | 2 | ||||
| -rw-r--r-- | Dockerfile | 6 | ||||
| -rw-r--r-- | compose.dev.yml | 18 | ||||
| -rw-r--r-- | compose.yml | 20 | 
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= @@ -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'  |