-
-
Save amitavroy/e049cf28c891d2b4220e75a88591d9d0 to your computer and use it in GitHub Desktop.
<VirtualHost *:80> | |
ServerName localhost | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/app/public | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> |
version: '3' | |
services: | |
web: | |
container_name: ${APP_NAME}_web | |
build: | |
context: ./docker/web | |
ports: | |
- 9000:80 | |
volumes: | |
- ./:/var/www/app | |
db: | |
container_name: ${APP_NAME}_db | |
image: postgres:10.5 | |
ports: | |
- 5432:5432 | |
volumes: | |
- ./pgdata:/var/lib/postgresql/data | |
environment: | |
- POSTGRES_PASSWORD=secret | |
- POSTGRES_USER=homestead | |
- POSTGRES_DB=homestead | |
cache: | |
container_name: ${APP_NAME}_cache | |
image: redis:4.0.11 | |
ports: | |
- 63790:6379 | |
search: | |
container_name: ${APP_NAME}_search | |
image: elasticsearch:6.4.1 | |
ports: | |
- 6200:9200 |
FROM php:7.2.10-apache-stretch | |
RUN apt-get update -yqq && \ | |
apt-get install -y apt-utils zip unzip && \ | |
apt-get install -y nano && \ | |
apt-get install -y libzip-dev libpq-dev && \ | |
a2enmod rewrite && \ | |
docker-php-ext-install pdo_pgsql && \ | |
docker-php-ext-install pgsql && \ | |
docker-php-ext-configure zip --with-libzip && \ | |
docker-php-ext-install zip && \ | |
rm -rf /var/lib/apt/lists/* | |
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer | |
COPY default.conf /etc/apache2/sites-enabled/000-default.conf | |
WORKDIR /var/www/app | |
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] | |
EXPOSE 80 |
I'll be using this for my Laravel for project for its simplicity. Thank you.
For anyone who wants to use mysql instead of pg, here's my Dockerfile.
FROM php:7.2.10-apache-stretch
RUN apt-get update -yqq && \
apt-get install -y apt-utils zip unzip && \
apt-get install -y nano && \
apt-get install -y libzip-dev && \
a2enmod rewrite && \
docker-php-ext-install mysqli pdo pdo_mysql && \
docker-php-ext-configure zip --with-libzip && \
docker-php-ext-install zip && \
rm -rf /var/lib/apt/lists/*
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
COPY default.conf /etc/apache2/sites-enabled/000-default.conf
WORKDIR /var/www/app
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
EXPOSE 80
and my docker-compose.yml
version: '3'
services:
web:
container_name: ${APP_NAME}_web
build:
context: ./docker/web
ports:
- 9000:80
volumes:
- ./:/var/www/app
depends_on:
- db
db:
container_name: ${APP_NAME}_db
image: mysql:5.7
ports:
- 3306:3306
restart: always
volumes:
- ./mysqldata:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=yourdb
I'm having the "Doctrine\DBAL\Driver\PDOException::("could not find driver")" every time i do the "php artisan migrate"
is there any Idea why that might happen?
this is my docker-compose :
version: '3'
services:
web:
container_name: ${APP_name}_web
build:
context: ./docker/web
ports:
- 8000:80
volumes:
- ./:/var/www/app
depends_on:
- db
db:
container_name: ${APP_name}_db
image: mysql:5.7
ports:
- "3306:3306"
restart: always
volumes:
- ./mysqldata:/var/lib/mysql/
environment:
- MYSQL_ROOT_PASSWORD=default
- MYSQL_DATABASE=takeaway
- MYSQL_USER=root
- MYSQL_PASSWORD=root
and this is my dockerfile :
FROM php:7.1.28-apache-stretch
RUN apt-get update -yqq &&
apt-get install -y apt-utils zip unzip &&
apt-get install -y nano &&
apt-get install -y libzip-dev &&
a2enmod rewrite &&
docker-php-ext-install mysqli pdo pdo_mysql &&
docker-php-ext-configure zip --with-libzip &&
docker-php-ext-install zip &&
rm -rf /var/lib/apt/lists/*
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
COPY default.conf /etc/apache2/sites-enabled/000-default.conf
WORKDIR /var/www/app
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
EXPOSE 80
hello ! i'm having a problem after i run the docker-compose and go to localhost:9000 there is a ERR_SSL_PROTOCOL_ERROR, what can i do ?
I'm getting this error..!
Building web
[+] Building 100.7s (7/10)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 680B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/php:7.2.10-apache-stretch 3.3s
=> [auth] library/php:pull token for registry-1.docker.io 0.0s
=> CACHED [1/5] FROM docker.io/library/php:7.2.10-apache-stretch@sha256:13f2eba8db9eb40f4a4f38a43716518513991d70698da28d56069ad9119abfab 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 34B 0.0s
=> ERROR [2/5] RUN apt-get update -yqq && apt-get install -y apt-utils zip unzip && apt-get install -y nano && apt-get install -y libzip-dev && a2enmod rewrite && docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-configure zip --with-libzi 97.3s
[2/5] RUN apt-get update -yqq && apt-get install -y apt-utils zip unzip && apt-get install -y nano && apt-get install -y libzip-dev && a2enmod rewrite && docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-configure zip --with-libzip && docker-php-ext-install zip && rm -rf /var/lib/apt/lists/*:
#6 96.27 W: GPG error: http://security.debian.org/debian-security buster/updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 112695A0E562B32A NO_PUBKEY 54404762BBB6E853
#6 96.27 W: The repository 'http://security.debian.org/debian-security buster/updates InRelease' is not signed.
#6 96.27 W: GPG error: http://deb.debian.org/debian buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY DCC9EFBF77E11517
#6 96.27 W: The repository 'http://deb.debian.org/debian buster InRelease' is not signed.
#6 96.27 W: GPG error: http://deb.debian.org/debian buster-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
#6 96.27 W: The repository 'http://deb.debian.org/debian buster-updates InRelease' is not signed.
#6 96.28 Reading package lists...
#6 97.04 Building dependency tree...
#6 97.17 Reading state information...
#6 97.22 Some packages could not be installed. This may mean that you have
#6 97.22 requested an impossible situation or if you are using the unstable
#6 97.22 distribution that some required packages have not yet been created
#6 97.22 or been moved out of Incoming.
#6 97.22 The following information may help to resolve the situation:
#6 97.22
#6 97.22 The following packages have unmet dependencies:
#6 97.26 apt-utils : Depends: apt (= 1.8.2.3) but 1.4.8 is to be installed
#6 97.27 E: Unable to correct problems, you have held broken packages.
executor failed running [/bin/sh -c apt-get update -yqq && apt-get install -y apt-utils zip unzip && apt-get install -y nano && apt-get install -y libzip-dev && a2enmod rewrite && docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-configure zip --with-libzip && docker-php-ext-install zip && rm -rf /var/lib/apt/lists/*]: exit code: 100
ERROR: Service 'web' failed to build : Build failed
Thank you