Docker support for local development

This commit is contained in:
SENOO, Ken 2022-10-16 18:00:43 +09:00 committed by Hugo Sales
parent 8edd975b11
commit c378019deb
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,9 @@
FROM php:7.4-apache
RUN apt update && apt install -y \
ssl-cert \
libicu-dev \
libjpeg-dev zlib1g-dev libpng-dev libwebp-dev
RUN docker-php-ext-configure gd --with-jpeg --with-webp
RUN docker-php-ext-install bcmath exif gettext gd intl mysqli
RUN a2enmod rewrite ssl
RUN a2ensite default-ssl

View File

@ -0,0 +1,32 @@
# Docker for development
This directory has docker related files for local development.
You can run GNU social on Docker by following commands on your local machine.
```
cd /path/to/repository
mkdir -p file/avatar
cp DOCUMENTATION/SYSTEM_ADMINISTRATORS/webserver_conf/htaccess.sample public/.htaccess
cd docker/development
docker compose up -d
```
After commands, you can open <https://localhost/installer.php> on your web browser. If you use Chromium/Google Chrome, you need to open <chrome://flags/#allow-insecure-localhost> and turn to [Enabled] for security alert.
In installer, you need to fill following database settings.
- Hostname: db
- Type: MariaDB
- Name: gnusocial
- DB username: root
- DB password: (empty)
You can remove container and named volume by following commands.
```
docker compose down
docker volume rm development_gnusocial-db
```

View File

@ -0,0 +1,26 @@
version: "3"
services:
db:
image: mariadb:10.3
restart: always
volumes:
- gnusocial-db:/var/lib/mysql
environment:
MYSQL_DATABASE: gnusocial
MYSQL_ALLOW_EMPTY_PASSWORD: 1
ports:
- 3306:3306
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
php:
build: .
restart: always
volumes:
- ../../:/var/www/
- ../../public:/var/www/html
ports:
- 80:80
- 443:443
depends_on:
- db
volumes:
gnusocial-db: