Skip to content

Instantly share code, notes, and snippets.

@CristianLlanos
Last active July 9, 2021 22:44
Show Gist options
  • Save CristianLlanos/34144646c00c52dc14a97f35530b7a15 to your computer and use it in GitHub Desktop.
Save CristianLlanos/34144646c00c52dc14a97f35530b7a15 to your computer and use it in GitHub Desktop.
elephant
set fish_greeting ''
set PATH ./node_modules/.bin $PATH
alias du="UID_GID=(id -u):(id -g) docker-compose -f ~/Code/php/docker-compose.yml up -d"
alias ds="docker-compose -f ~/Code/php/docker-compose.yml stop"
version: '3.1'
services:
mysql:
container_name: mysql
image: mysql
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=root
volumes:
- ./mysql:/var/lib/mysql
playground:
container_name: playground
image: playground
command: bash -c "php -S 0.0.0.0:8089"
user: "${UID_GID}"
build: .
ports:
- 8089:8089
- 80:8000
volumes:
- .:/project
- ./php.ini:/usr/local/etc/php/conf.d/custom.ini
- ~/.ssh:/root/.ssh
FROM php:7.4-cli
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
RUN apt-get update
RUN apt update
RUN apt autoremove -y
RUN apt-get install -y \
fish \
vim \
libzip-dev \
zip
RUN docker-php-ext-install zip
RUN apt-get install -y libpng-dev
RUN docker-php-ext-install gd
RUN docker-php-ext-install pdo_mysql
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
ENV PATH "$PATH:./vendor/bin"
ENV PATH "$PATH:~/.composer/vendor/bin"
RUN composer global require laravel/installer
RUN apt install -y nodejs npm
WORKDIR /project
#!/bin/bash
docker run --rm -v (pwd):/opt -w /opt playground:latest npm install
[performance]
memory_limit = 1800M
display_errors = On
error_reporting = E_ALL
[xdebug]
xdebug.client_host="host.docker.internal"
xdebug.idekey=PHPSTORM
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.max_nesting_level=600
#!/bin/bash
CONTAINER_NAME="elephant"
# Build Docker Image
docker build \
--tag ${CONTAINER_NAME}:latest \
.
# Run Container
docker run \
--detach \
--interactive \
--tty \
--rm \
--volume $(pwd):/project \
--name $CONTAINER_NAME \
-p 9000:8000 \
$CONTAINER_NAME
# Add the following argument in docker run to protect OS user
# --user $(id -u ${USER}):$(id -g ${USER}) \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment