Skip to content

Instantly share code, notes, and snippets.

@hgrimelid
Created September 26, 2023 09:26
Show Gist options
  • Save hgrimelid/bbd04600a0349692fa023cc30f4f9ca9 to your computer and use it in GitHub Desktop.
Save hgrimelid/bbd04600a0349692fa023cc30f4f9ca9 to your computer and use it in GitHub Desktop.
Laravel 8 + PHP 8.0 in Docker
DB_CONNECTION=mysql
DB_HOST=host.docker.internal
DB_PORT=33060
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=password
version: '3.8'
services:
main:
build:
context: .
dockerfile: Dockerfile
command: 'php artisan serve --host=0.0.0.0'
volumes:
- .:/app
ports:
- 8000:8000
depends_on:
- db
db:
image: mysql
ports:
- 33060:3306
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: realestate
FROM php:8.0-fpm-alpine
RUN apk add --no-cache zip libzip-dev
RUN docker-php-ext-install pdo pdo_mysql sockets exif zip
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin --filename=composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /app
COPY . .
RUN composer install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment