#duh! Pick the base image (this is latest as of May 2020)
FROM php:7.4.5-apache
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#duh!
RUN apt-get update
#Install zip+icu dev libs
RUN apt-get install libzip-dev zip libicu-dev -y
#Install PHP extensions zip and intl (intl requires to be configured)
RUN docker-php-ext-install zip && docker-php-ext-configure intl && docker-php-ext-install intl
#Required for htaccess rewrite rules
RUN a2enmod rewrite
Last active
June 21, 2020 04:23
-
-
Save jdecode/69f51cc0680de7c885770cbef65ba254 to your computer and use it in GitHub Desktop.
Docker commands that I run almost every time I am qaing something new
Laravel
Dockerfile
content
FROM jdecode/laravelphp:0.3
(Yes, I got lazy with naming, or rather this is neat)
docker-compose.yml
content
version: "3"
services:
laravel:
build:
context: .
dockerfile: Dockerfile
image: laravelphp:0.x
ports:
- 8080:80
links:
- mysql
- redis
depends_on:
- mysql
- redis
environment:
#DATABASE_URL: mysql://root:mysqldocker@172.53.1.2/laravel
DATABASE_URL: postgres://postgres:docker@172.53.1.3/laravel
networks:
laravel_net:
ipv4_address: 172.53.1.1
mysql:
image: mysql:latest
#image: mysql:5.7.24
ports:
- 3306:33060
volumes:
- mysql_data:/var/lib/mysql
restart: always
container_name: laravel-mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: mysqldocker
MYSQL_DATABASE: laravel
networks:
laravel_net:
ipv4_address: 172.53.1.2
pgsql:
image: postgres:latest
ports:
- 5432:54320
volumes:
- pgsql_data:/var/lib/postgres
container_name: laravel-pgsql
environment:
POSTGRES_PASSWORD: pgsqldocker
POSTGRES_DB: laravel
networks:
laravel_net:
ipv4_address: 172.53.1.3
redis:
image: redis:latest
restart: always
container_name: laravel-redis
ports:
- 6379:63790
networks:
laravel_net:
ipv4_address: 172.53.1.4
volumes:
mysql_data: {}
pgsql_data: {}
redis_data: {}
networks:
laravel_net:
ipam:
driver: default
config:
- subnet: 172.53.0.0/16
Instructions to use above Dockerfile and docker-compose.yml files.
Place these in a folder, and go to Ubuntu 19.10 CLI (not tested anywhere else, yet) and enter:
docker-compose up --build
For CakePHP, go to 172.43.1.1
For Laravel, go to 172.53.1.1
Switched to Ubuntu 20.04 and docker login
was failing.
Google/GitHub gave the solution - sudo apt install golang-docker-credential-helpers
docker-compose run kode bin/cake migrations migrate
docker-compose run kode bin/cake migrations seed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CakePHP
Dockerfile
content:(yes, that is it)
docker-compose.yml
(this is a long file, yes)