Skip to content

Commit

Permalink
fix(Docker): move docker to docker folder, better doc, use mysql inst…
Browse files Browse the repository at this point in the history
…ead off mariadb
  • Loading branch information
mrflos committed Dec 12, 2023
1 parent a0744de commit deb6607
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 127 deletions.
24 changes: 0 additions & 24 deletions Dockerfile

This file was deleted.

29 changes: 1 addition & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
COMPOSER = composer
GIT = git
YARN = yarn
DOCKER = docker-compose
DOCKER_COMPOSE= $$( if [ -f docker-compose.local.yml ]; then \
echo docker-compose.local.yml; \
else \
echo docker-compose.yml; \
fi )
.DEFAULT_GOAL = help

## —— Yeswiki Makefile ——
help: ## Outputs this help screen
Expand All @@ -29,27 +22,7 @@ yarn-install: yarn.lock ## Install npm vendors according to the current yarn.loc
$(YARN) install

## —— Docker ——————————————
perms:
chmod 0777 . cache files files/backgrounds files/backgrounds/thumbs themes custom tools && \
chmod -R +w themes/margot

docker-build: ## Build Docker images
$(DOCKER) -f $(DOCKER_COMPOSE) build --pull

dev: ## Start the Docker hub with all the dev tools
$(DOCKER) -f $(DOCKER_COMPOSE) up -d

up: ## Start the Docker hub
$(DOCKER) -f $(DOCKER_COMPOSE) up -d yeswiki

stop: ## Stop the Docker hub
$(DOCKER) -f $(DOCKER_COMPOSE) stop

down: ## Down the Docker hub
$(DOCKER) -f $(DOCKER_COMPOSE) down --remove-orphans

shell: ## Start shell inside Docker
$(DOCKER) -f $(DOCKER_COMPOSE) exec yeswiki bash
## use the docker/ folder README.md to find commands to launch docker

## —— Tests ———————————————
test: ## Launch unit tests
Expand Down
20 changes: 14 additions & 6 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
# Build image
# Docker usage

## Build image

```
```bash
docker compose build
```
# Launch image

## Launch image

- `docker compose up -d`
- yeswiki should be accessible at `localhost:8085`

# Dev version
## Dev version

- allow www-data to right local directory
This version should map the local repository to your docker container.

This version should map the local repository to your docker container.
- `docker compose up -f docker-compose-dev.yml`

## Remove all docker images and volumes

```bash
docker compose stop
docker compose rm
docker volume rm yeswiki yeswiki-db
```
62 changes: 31 additions & 31 deletions docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"

volumes:
yeswiki-db:
Expand All @@ -8,35 +8,35 @@ networks:
yeswiki:

services:
yeswiki-app:
build:
context: ..
dockerfile: ./docker/dockerfile
container_name: yeswiki
volumes:
- ..:/var/www/html
depends_on:
- yeswiki-db
env_file: ./yeswiki.secrets
networks:
- yeswiki
yeswiki-app:
build:
context: ..
dockerfile: ./docker/dockerfile
container_name: yeswiki
volumes:
- ..:/var/www/html
depends_on:
- yeswiki-db
env_file: ./yeswiki.secrets
networks:
- yeswiki

yeswiki-db:
image: mariadb:11
container_name: yeswiki-db
volumes:
- yeswiki-db:/var/lib/mysql
env_file: ./yeswiki.secrets
networks:
- yeswiki
yeswiki-db:
image: mysql:latest
container_name: yeswiki-db
volumes:
- yeswiki-db:/var/lib/mysql
env_file: ./yeswiki.secrets
networks:
- yeswiki

yeswiki-web:
image: nginx:alpine
container_name: yeswiki-web
volumes:
- ..:/var/www/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8085:80"
networks:
- yeswiki
yeswiki-web:
image: nginx:alpine
container_name: yeswiki-web
volumes:
- ..:/var/www/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8085:80"
networks:
- yeswiki
68 changes: 34 additions & 34 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"

volumes:
yeswiki-db:
Expand All @@ -10,38 +10,38 @@ networks:
yeswiki:

services:
yeswiki-app:
build:
context: ..
dockerfile: ./docker/dockerfile
container_name: yeswiki
volumes:
- yeswiki:/var/www/html
depends_on:
- yeswiki-db
env_file: ./yeswiki.secrets
networks:
- yeswiki
yeswiki-app:
build:
context: ..
dockerfile: ./docker/dockerfile
container_name: yeswiki
volumes:
- yeswiki:/var/www/html
depends_on:
- yeswiki-db
env_file: ./yeswiki.secrets
networks:
- yeswiki

yeswiki-db:
image: mariadb:11
container_name: yeswiki-db
volumes:
- yeswiki-db:/var/lib/mysql
env_file: ./yeswiki.secrets
networks:
- yeswiki
restart: unless-stopped
yeswiki-db:
image: mysql:latest
container_name: yeswiki-db
volumes:
- yeswiki-db:/var/lib/mysql
env_file: ./yeswiki.secrets
networks:
- yeswiki
restart: unless-stopped

yeswiki-web:
image: nginx:alpine
container_name: yeswiki-web
volumes:
- yeswiki:/var/www/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8085:80"
depends_on:
- yeswiki-app
networks:
- yeswiki
yeswiki-web:
image: nginx:alpine
container_name: yeswiki-web
volumes:
- yeswiki:/var/www/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8085:80"
depends_on:
- yeswiki-app
networks:
- yeswiki
8 changes: 4 additions & 4 deletions docker/yeswiki.secrets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MARIADB_DATABASE=yeswiki
MARIADB_ROOT_PASSWORD=root
MARIADB_USER=yeswiki
MARIADB_PASSWORD=password
MYSQL_DATABASE=yeswiki
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=yeswiki
MYSQL_PASSWORD=password

0 comments on commit deb6607

Please sign in to comment.