Skip to content

Instantly share code, notes, and snippets.

@vilmid
Last active April 14, 2021 13:36
Show Gist options
  • Select an option

  • Save vilmid/500e295b71f60a45f9d8d15a186d581e to your computer and use it in GitHub Desktop.

Select an option

Save vilmid/500e295b71f60a45f9d8d15a186d581e to your computer and use it in GitHub Desktop.
Laravel + Apache + PostgreSQL
version: '3'
services:
web:
environment:
COMPOSER_HOME: ./docker/web/.config/composer
COMPOSER_CACHE_DIR: ./docker/web/.cache/composer
ports:
- target: 80
published: 8000
- target: 443
published: 4430
volumes:
- type: bind
source: ./src/laravel
target: /var/www/laravel
db:
ports:
- target: 5432
published: 54320
version: '3'
services:
web:
build:
context: .
dockerfile: ./docker/web/Dockerfile
depends_on:
- db
db:
image: postgres
FROM php:8-apache
COPY --from=composer /usr/bin/composer /usr/bin/composer
ENV APACHE_DOCUMENT_ROOT /var/www/laravel/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN chown www-data /var/www -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment