Skip to content

Instantly share code, notes, and snippets.

@eduardoarandah
Last active March 6, 2023 23:58
Show Gist options
  • Save eduardoarandah/ca369823a20da7b773160961c5c59e0b to your computer and use it in GitHub Desktop.
Save eduardoarandah/ca369823a20da7b773160961c5c59e0b to your computer and use it in GitHub Desktop.
php7.4, mariadb and mailcrab on docker for laravel/wordpress
version: "3.8"
volumes:
mariadb104:
name: mariadb104
services:
db:
image: mariadb:10.4 # mysql 5.7
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: asdf
MYSQL_DATABASE: sinetiksapp
volumes:
- mariadb104:/var/lib/mysql
- ./:/app
# GUI: http://localhost:1080
mail:
image: marlonb/mailcrab:latest
ports:
- 1025:1025
- 1080:1080
# https://www.digitalocean.com/community/tutorials/how-to-install-and-set-up-laravel-with-docker-compose-on-ubuntu-22-04
app:
build:
args:
user: lalo
uid: 501
context: ./
dockerfile: Dockerfile
image: sinetiksapp
container_name: sinetiksapp-app
# restart: unless-stopped
working_dir: /app
ports:
- 8000:8000
volumes:
- ./:/app
command: sh -c "composer install && php artisan serve --host=0.0.0.0:8000"
# https://www.digitalocean.com/community/tutorials/how-to-install-and-set-up-laravel-with-docker-compose-on-ubuntu-22-04
FROM php:7.4-cli
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd intl
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
# Set working directory
WORKDIR /app
USER $user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment