mirror of
https://github.com/supanadit/todo.git
synced 2024-11-10 01:42:20 +00:00
feat: development support with docker
This commit is contained in:
parent
5f36d147be
commit
730763a58a
5
Caddyfile
Normal file
5
Caddyfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
:80 {
|
||||||
|
root * /srv/public
|
||||||
|
file_server
|
||||||
|
php_fastcgi todo:9000
|
||||||
|
}
|
10
PHP.Dockerfile
Normal file
10
PHP.Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM php:7.4-fpm
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
|
||||||
|
RUN apt-get install -y git zip
|
||||||
|
|
||||||
|
RUN docker-php-ext-install pdo pdo_mysql
|
||||||
|
|
||||||
|
# Composer
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
|
50
README.md
50
README.md
@ -72,6 +72,56 @@ docker-compose exec todo-app php artisan migrate
|
|||||||
docker-compose exec todo-app php artisan db:seed
|
docker-compose exec todo-app php artisan db:seed
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Development Using Docker
|
||||||
|
|
||||||
|
### Run Application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installing / Updating Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml exec -w /srv todo composer install # Composer Install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Generate Key
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan key:generate # Generate Key
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database Migration
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database Seed
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan db:seed
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shutdown Application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Updating `.env`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan config:cache
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rebuilding Dockerfile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose.dev.yml build
|
||||||
|
```
|
||||||
|
|
||||||
### Troubleshooting MySQL Won't Run In Docker
|
### Troubleshooting MySQL Won't Run In Docker
|
||||||
|
|
||||||
Run this script `sudo chown -R 1001:1001 mysql`
|
Run this script `sudo chown -R 1001:1001 mysql`
|
||||||
|
26
docker-compose.dev.yml
Normal file
26
docker-compose.dev.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
todo:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: PHP.Dockerfile
|
||||||
|
volumes:
|
||||||
|
- "./:/srv"
|
||||||
|
|
||||||
|
caddy:
|
||||||
|
image: caddy:2.5.0-alpine
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
volumes:
|
||||||
|
- "./Caddyfile:/etc/caddy/Caddyfile"
|
||||||
|
- "./:/srv"
|
||||||
|
|
||||||
|
mysqldb:
|
||||||
|
image: "bitnami/mysql:8.0"
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- "./mysql:/bitnami/mysql/data"
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=secret
|
||||||
|
- MYSQL_DATABASE=todo
|
Loading…
Reference in New Issue
Block a user