diff --git a/docker-compose.override-backend-dev.yml b/docker-compose.override-backend-dev.yml index 4aa37c8..8bef6ae 100644 --- a/docker-compose.override-backend-dev.yml +++ b/docker-compose.override-backend-dev.yml @@ -16,12 +16,13 @@ version: "3.3" services: backend: - command: bash -c "./prestart.sh; while true; do sleep 1; done" # Infinite loop to keep container live doing nothing + command: bash -c "poetry install --no-root; ./prestart.sh; while true; do sleep 1; done" # Infinite loop to keep container live doing nothing volumes: - ./:/app environment: - PYTHONPATH=/app/backend working_dir: /app/backend build: + context: ./backend args: - INSTALL_DEV: "true" \ No newline at end of file + INSTALL_DEV: ${INSTALL_DEV-true} \ No newline at end of file diff --git a/docker-compose.override-frontend-dev.yml b/docker-compose.override-frontend-dev.yml index 119da76..8f2d732 100644 --- a/docker-compose.override-frontend-dev.yml +++ b/docker-compose.override-frontend-dev.yml @@ -21,6 +21,8 @@ services: working_dir: /app/frontend command: bash -c "npm install && while true; do sleep 1; done" # Infinite loop to keep container live doing nothing build: + context: ./frontend args: INSTALL_DEV: ${INSTALL_DEV-true} + FRONTEND_ENV: dev INSTALL_PUPPETEER: ${INSTALL_PUPPETEER-false} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 75729d5..23a8847 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,14 +69,14 @@ services: - node.labels.${STACK_NAME?Variable not set}.app-db-data == true backend: - image: 'backend:latest' + image: 'ghcr.io/project-chip/csa-certification-tool-backend:latest' ports: - "8888:8888" volumes: - /var/run/docker.sock:/var/run/docker.sock - /usr/bin/docker:/usr/bin/docker - /var/run/dbus:/var/run/dbus - - ./backend:/app # mount code in container + - ./backend/test_collections:/app/test_collections # mount test_collections in container depends_on: - db env_file: @@ -88,10 +88,7 @@ services: privileged: true build: context: ./backend - dockerfile: backend.dockerfile - args: - INSTALL_DEV: ${INSTALL_DEV-false} - command: /start-reload.sh + command: /start.sh labels: - traefik.enable=true - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} @@ -99,13 +96,9 @@ services: - traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=80 frontend: - image: 'frontend:latest' + image: 'ghcr.io/project-chip/csa-certification-tool-frontend' build: context: ./frontend - args: - FRONTEND_ENV: dev - INSTALL_PUPPETEER: ${INSTALL_PUPPETEER-false} - INSTALL_DEV: ${INSTALL_DEV-false} labels: - traefik.enable=true - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} diff --git a/scripts/build-no-cache.sh b/scripts/build-no-cache.sh deleted file mode 100755 index 3bc4811..0000000 --- a/scripts/build-no-cache.sh +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env sh - - # - # Copyright (c) 2023 Project CHIP Authors - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - -# Exit in case of error -set -e - -# Ensure .env exists -./scripts/install-default-env.sh - -docker-compose -f docker-compose.yml config > docker-stack.yml -docker-compose -f docker-stack.yml build --no-cache diff --git a/scripts/build.sh b/scripts/build.sh index 745fff0..4c2973b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,10 +18,5 @@ # Exit in case of error set -e -# Ensure .env exists -./scripts/install-default-env.sh - -FRONTEND_ENV=${FRONTEND_ENV-production} \ -docker-compose \ --f docker-compose.yml \ -build +./backend/scripts/build-docker-image.sh "$@" +./frontend/scripts/build-docker-image.sh "$@" diff --git a/scripts/record-backend-sha-version.sh b/scripts/record-backend-sha-version.sh deleted file mode 100755 index 7786227..0000000 --- a/scripts/record-backend-sha-version.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env sh - - # - # Copyright (c) 2023 Project CHIP Authors - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - -#Current directory -CURRENT_DIR=$(dirname $(realpath "$0")) -#Parent directory -PARENT_DIR=$(dirname ${CURRENT_DIR}) - -#environment file where the backend SHA will be saved into. -BACKEND_SHA_FILE="${PARENT_DIR}/backend/.sha_information" - -#Delete any stale SHA information -if [ -f "$BACKEND_SHA_FILE" ]; then - rm $BACKEND_SHA_FILE -fi - -#Save the backend SHA -output=$(git -C ./backend rev-parse --short HEAD) - -#copy the SHA into a file in the parent directory -echo "${output}" > $BACKEND_SHA_FILE diff --git a/scripts/start.sh b/scripts/start.sh index bcd67e3..b12cec4 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -29,9 +29,6 @@ set -e # Ensure .env exists ./scripts/install-default-env.sh -# Record Backend SHA to a file -sh ./scripts/record-backend-sha-version.sh - # Dev override files BACKEND_COMPOSE="-f docker-compose.override-backend-dev.yml" FRONTEND_COMPOSE="-f docker-compose.override-frontend-dev.yml" @@ -54,10 +51,6 @@ do DEV_COMPOSE_FILES="$DEV_COMPOSE_FILES $FRONTEND_COMPOSE" shift # Remove --frontend from processing ;; - --build-no-cache) - COMPOSE_CACHE_OPTION="--no-cache" - shift # Remove --build-no-cache from processing - ;; *) OTHER_ARGUMENTS+=("$1") shift # Remove generic argument from processing @@ -65,18 +58,8 @@ do esac done - -docker-compose \ --f docker-compose.yml \ -$DEV_COMPOSE_FILES \ -config > docker-stack.yml - -if [ ! -z "$COMPOSE_CACHE_OPTION" ] ; then - echo "Building no-cache" - docker-compose -f docker-stack.yml build $COMPOSE_CACHE_OPTION -fi - -docker-compose -f docker-stack.yml up -d +# Start docker containers with docker-compose +docker-compose -f docker-compose.yml $DEV_COMPOSE_FILES up -d if [ "$FRONTEND_DEV" = true ] ; then echo "!!!! Matter TH frontend started in development mode." diff --git a/scripts/stop.sh b/scripts/stop.sh index 87a7b42..98b59fb 100755 --- a/scripts/stop.sh +++ b/scripts/stop.sh @@ -18,4 +18,4 @@ ROOT_DIR=$(realpath $(dirname "$0")/..) cd $ROOT_DIR # Exit in case of error set -e -docker-compose -f docker-stack.yml down \ No newline at end of file +docker-compose -f docker-compose.yml down \ No newline at end of file