diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 0b68d03cc..000000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM lavoweb/php-8.2:composer - -# Add MySQLi -RUN docker-php-ext-install mysqli - -# Add Chromium browser to enable pdf creation -RUN apt-get --allow-releaseinfo-change update && apt install -y --no-install-recommends \ - chromium \ - git -RUN rm -rf /var/cache/apk/* \ - rm -rf /tmp/* - -# Add default theme -RUN mkdir -p themes/margot \ - && curl -o - -sSL https://github.com/YesWiki/yeswiki-theme-margot/archive/master.tar.gz \ - | tar xzfv - --strip-components 1 -C themes/margot - -# Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# Node & NPM & Yarn -RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - -RUN apt-get install -y --no-install-recommends nodejs -RUN npm install -g yarn diff --git a/Makefile b/Makefile index 4bc7056dd..5452934bb 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 diff --git a/docker/README.md b/docker/README.md index 594d54bae..6e24b3f0d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -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 +``` diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index eb9aba936..6aa8c46a7 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -1,4 +1,4 @@ -version: '3.7' +version: "3.7" volumes: yeswiki-db: @@ -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 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index ad88ec332..f77fbdca4 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.7' +version: "3.7" volumes: yeswiki-db: @@ -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 diff --git a/docker/yeswiki.secrets b/docker/yeswiki.secrets index 3427931f7..1141143ad 100644 --- a/docker/yeswiki.secrets +++ b/docker/yeswiki.secrets @@ -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