Add Docker

This commit is contained in:
Jérémy REYNAUD 2020-05-27 16:22:38 +02:00
parent 0a92002919
commit fca2f44231
No known key found for this signature in database
GPG Key ID: BB12BB2D37753020
4 changed files with 46 additions and 0 deletions

1
docker/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

11
docker/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM php:7.4-cli-alpine
RUN apk add \
libzip-dev \
oniguruma-dev
RUN docker-php-ext-install \
zip \
mbstring \
iconv \
fileinfo

14
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
version: '3'
services:
php:
build:
context: .
user: "${USER_ID}:${GROUP_ID}"
volumes:
- ..:/var/www/html
- "${ROOT_PATH}:/var/www/html/data"
restart: "no"
ports:
- "${PORT:-8000}:8000"
command: php -S 0.0.0.0:8000 -t /var/www/html/data /var/www/html/tinyfilemanager.php

20
docker/start.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
if [[ ! -f ".env" ]]; then
echo "COMPOSE_PROJECT_NAME=tinyfilemanager" >> .env
root_path=""
while [[ "${root_path}" == "" ]]; do
read -p "Define the root path: " root_path
done
echo "ROOT_PATH=${root_path}" >> .env
echo "USER_ID=$(id -u)" >> .env
echo "GROUP_ID=$(id -g)" >> .env
fi
docker-compose stop
docker-compose build --parallel
docker-compose up -d --remove-orphans