Add postgres database container to test PDO driver

This commit is contained in:
Anton Komarev
2023-09-04 10:19:38 +03:00
parent 1bfb082c58
commit f2be5bec40
3 changed files with 33 additions and 4 deletions

View File

@@ -3,16 +3,23 @@
# ----------------------
FROM php:7.4-fpm-alpine AS dev
RUN apk add \
RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
freetype-dev \
libpng-dev
libpng-dev \
postgresql-dev
# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*
# Configure php extensions
RUN docker-php-ext-configure gd --with-freetype
# Install php extensions
RUN docker-php-ext-install \
gd
gd \
pdo \
pdo_pgsql
# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/.docker-volume-postgres/
/.idea/
/vendor/
.env
.idea/

View File

@@ -7,6 +7,8 @@ services:
context: ./
dockerfile: ./.docker/php/Dockerfile
restart: unless-stopped
depends_on:
- postgres
working_dir: /app
volumes:
- ./:/app
@@ -30,6 +32,25 @@ services:
networks:
- ghpvc
postgres:
container_name: ${PROJECT_NAME}-postgres
image: postgres:13.4-alpine
restart: unless-stopped
ports:
- "${DB_PORT:-5432}:${DB_PORT:-5432}"
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_NAME}
volumes:
- ./.docker-volume-postgres:/var/lib/postgresql/data
networks:
- ghpvc
volumes:
.docker-volume-postgres:
driver: local
networks:
ghpvc:
driver: bridge