From 91f1fe8671466c566ac5e2c2e2ab834e39058573 Mon Sep 17 00:00:00 2001 From: Dmitry Stoyanov Date: Sat, 26 Oct 2024 15:22:22 +0300 Subject: [PATCH] Update docker-compose to use as plugin instead of separate tool --- .github/workflows/certbot-update-cert.yml | 6 +++--- .github/workflows/create_cert.yml | 2 +- .github/workflows/docker-build-push-redeploy.yml | 6 +++--- .github/workflows/instances-redeploy.yml_tmp | 6 +++--- Dockerfile | 2 +- Dockerfile_frontend | 4 ++-- Dockerfile_frontend_with_tls | 4 ++-- Makefile | 8 ++++---- README.md | 4 ++-- docker-compose-run.yml | 15 +++++++-------- docker-compose-unit-test.yml | 1 - docker-compose-with-secret.yml | 1 - docker-compose.yml | 1 - 13 files changed, 28 insertions(+), 32 deletions(-) diff --git a/.github/workflows/certbot-update-cert.yml b/.github/workflows/certbot-update-cert.yml index 786f85b16..01edccaf2 100644 --- a/.github/workflows/certbot-update-cert.yml +++ b/.github/workflows/certbot-update-cert.yml @@ -26,7 +26,7 @@ jobs: API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }} - name: Update certs run: | - docker-compose pull - docker-compose run --rm certbot renew --allow-subset-of-names - docker-compose restart brn_fe_with_tls + docker compose pull + docker compose run --rm certbot renew --allow-subset-of-names + docker compose restart brn_fe_with_tls docker image prune -af diff --git a/.github/workflows/create_cert.yml b/.github/workflows/create_cert.yml index 113d343d5..a2506de12 100644 --- a/.github/workflows/create_cert.yml +++ b/.github/workflows/create_cert.yml @@ -22,4 +22,4 @@ jobs: API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }} - name: Create cert run: | - docker-compose run --rm certbot certonly --webroot --webroot-path=/var/www/html --email brainupproject@yandex.ru -d brainup.fun + docker compose run --rm certbot certonly --webroot --webroot-path=/var/www/html --email brainupproject@yandex.ru -d brainup.fun diff --git a/.github/workflows/docker-build-push-redeploy.yml b/.github/workflows/docker-build-push-redeploy.yml index 1f501a15b..90b9fd0fe 100644 --- a/.github/workflows/docker-build-push-redeploy.yml +++ b/.github/workflows/docker-build-push-redeploy.yml @@ -67,10 +67,10 @@ jobs: # Link 2: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif - name: Redeploy backend run: | - docker-compose pull - docker-compose up -d --no-deps brn + docker compose pull + docker compose up -d --no-deps brn - name: Redeploy frontend selectel if: matrix.runners == 'selectel' - run: docker-compose up -d --no-deps brn_fe_with_tls + run: docker compose up -d --no-deps brn_fe_with_tls - name: Remove old images run: docker image prune -af diff --git a/.github/workflows/instances-redeploy.yml_tmp b/.github/workflows/instances-redeploy.yml_tmp index 719a9f2a6..36072deb5 100644 --- a/.github/workflows/instances-redeploy.yml_tmp +++ b/.github/workflows/instances-redeploy.yml_tmp @@ -27,6 +27,6 @@ jobs: POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - name: Redeploy application run: | - docker-compose pull - docker-compose down - docker-compose up -d + docker compose pull + docker compose down + docker compose up -d diff --git a/Dockerfile b/Dockerfile index d3aded2f5..ea6142eba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gradle:jdk17 as builder +FROM gradle:jdk17 AS builder WORKDIR /brn ADD . /brn diff --git a/Dockerfile_frontend b/Dockerfile_frontend index e97286b9f..7304ee2f5 100644 --- a/Dockerfile_frontend +++ b/Dockerfile_frontend @@ -1,4 +1,4 @@ -FROM node:12 as build-frontend +FROM node:12 AS build-frontend ARG FIREBASE_PROJECT_ID ENV FIREBASE_PROJECT_ID ${FIREBASE_PROJECT_ID:-} ARG FIREBASE_AUTH_DOMAIN @@ -10,7 +10,7 @@ WORKDIR /src RUN yarn RUN node node_modules/ember-cli/bin/ember deploy production -FROM node:12 as build-frontend-angular +FROM node:12 AS build-frontend-angular COPY frontend-angular/ /src/ WORKDIR /src RUN npm ci diff --git a/Dockerfile_frontend_with_tls b/Dockerfile_frontend_with_tls index 3874d34c1..433cd13e7 100644 --- a/Dockerfile_frontend_with_tls +++ b/Dockerfile_frontend_with_tls @@ -1,10 +1,10 @@ -FROM node:12 as build-frontend +FROM node:12 AS build-frontend COPY frontend/ /src/ WORKDIR /src RUN yarn RUN node node_modules/ember-cli/bin/ember deploy production -FROM node:12 as build-frontend-angular +FROM node:12 AS build-frontend-angular COPY frontend-angular/ /src/ WORKDIR /src RUN npm ci diff --git a/Makefile b/Makefile index a224ef5f5..b3f615eae 100644 --- a/Makefile +++ b/Makefile @@ -12,15 +12,15 @@ docker_clean_app_images: stop docker rmi brn_test db_brn brn docker_clean_test_containers: - docker-compose -f docker-compose-unit-test.yml down + docker compose -f docker-compose-unit-test.yml down docker_unit_test: clean - docker-compose -f docker-compose-unit-test.yml up --build --force-recreate --exit-code-from brn-test + docker compose -f docker-compose-unit-test.yml up --build --force-recreate --exit-code-from brn-test start: - docker-compose up --build --force-recreate + docker compose up --build --force-recreate stop: - docker-compose down + docker compose down restart: clean stop start diff --git a/README.md b/README.md index cea610a26..9702eb0ff 100644 --- a/README.md +++ b/README.md @@ -127,11 +127,11 @@ Note that if you are using IntelliJ, you may want to use version 2019.2 and late (back-end part and front-end parts, but it is rather slow. it is better to use GitPod) From console, from project's folder, execute: ```bash -docker-compose up --build +docker compose up --build ``` Alternatively, use daemon mode (no console output): ```bash -docker-compose up --build -d +docker compose up --build -d ``` Local REST API will be accessible at http://localhost:8081/api/swagger-ui.html Public is always here https://brainup.site/admin/swagger (login with ADMIN role user) diff --git a/docker-compose-run.yml b/docker-compose-run.yml index 0401b4032..b3425f92f 100644 --- a/docker-compose-run.yml +++ b/docker-compose-run.yml @@ -1,4 +1,3 @@ -version: '3.8' services: db_brn: image: postgres:13 @@ -33,13 +32,13 @@ services: - firebase_config_json depends_on: - db_brn - brn_fe: - image: brainup/brn-frontend:latest - container_name: brn_fe -# ports: -# - 80:80 - depends_on: - - brn +# brn_fe: +# image: brainup/brn-frontend:latest +# container_name: brn_fe +# # ports: +# # - 80:80 +# depends_on: +# - brn brn_fe_with_tls: image: brainup/brn-frontend-with-tls:latest container_name: brn_fe_with_tls diff --git a/docker-compose-unit-test.yml b/docker-compose-unit-test.yml index ff4ccf698..63d012cb0 100644 --- a/docker-compose-unit-test.yml +++ b/docker-compose-unit-test.yml @@ -1,4 +1,3 @@ -version: '3.8' services: db: image: postgres:13 diff --git a/docker-compose-with-secret.yml b/docker-compose-with-secret.yml index 49660c0fd..0f8933f09 100644 --- a/docker-compose-with-secret.yml +++ b/docker-compose-with-secret.yml @@ -1,4 +1,3 @@ -version: '3.8' services: db_brn: image: postgres:13 diff --git a/docker-compose.yml b/docker-compose.yml index 1f10d5bb6..a2737bfef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.8' services: db_brn: container_name: db_brn