diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 82c19866d..c46304f33 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,23 +1,5 @@ # FOSSology docker-compose file - -# Copyright (C) 2022 Vineet Vatsal (vineetvatsal09@gmail.com) - -# SPDX-License-Identifier: GPL-2.0 - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# version 2 as published by the Free Software Foundation. -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Description: docker-compose file for development environment. - +# Development environment for FOSSologyUI (Next.js + pnpm) version: "3.9" @@ -27,40 +9,44 @@ services: context: . dockerfile: Dockerfile.dev args: - - NEXT_PUBLIC_SERVER_URL=localhost/repo/api/v2 + - NEXT_PUBLIC_SERVER_URL=http://localhost/repo/api/v2 - NEXT_PUBLIC_HTTPS=false - image: fossologyui:react1.0 + image: fossologyui:dev + platform: ${DOCKER_PLATFORM:-linux/amd64} + environment: - - NEXT_PUBLIC_SERVER_URL=localhost/repo/api/v2 + - NEXT_PUBLIC_SERVER_URL=http://localhost/repo/api/v2 - NEXT_PUBLIC_HTTPS=false - command: ../node_modules/.bin/react-scripts start + + # ✅ Correct command for Next.js dev server + command: ["pnpm", "dev"] + ports: - "3000:3000" + volumes: - - .:/usr/src/fossologyui/app:delegated - # bind-mounting these three files in will let you add packages during development without rebuilding - # for example, to add bower to your app while developing, just install it inside the container - # and then nodemon will restart. Your changes will last until you "docker-compose down" and will - # be saved on host for next build - # NOTE: this won't work on Docker Toolbox (virtualbox) which doesn't bind-mount single files - # docker-compose exec node npm install --save bower + # Mount project root into the container as app/ + - .:/usr/src/fossologyui:delegated + + # Mount package files so pnpm install works inside container - ./package.json:/usr/src/fossologyui/package.json - ./pnpm-lock.yaml:/usr/src/fossologyui/pnpm-lock.yaml - # this is a workaround to prevent host node_modules from accidently getting mounted in container - # in case you want to use node/npm both outside container for test/lint etc. and also inside container - # this will overwrite the default node_modules dir in container so it won't conflict with our - # /usr/src/fossologyui/node_modules location. + + # Prevent your host node_modules from overwriting container node_modules - notused:/usr/src/fossologyui/node_modules fossology_server: image: fossology/fossology:latest + platform: ${DOCKER_PLATFORM:-linux/amd64} + ports: - "8081:80" + volumes: - repository:/srv/fossology/repository/ - database:/var/lib/postgresql/data - + volumes: notused: repository: - database: + database: \ No newline at end of file diff --git a/start-dev.sh b/start-dev.sh new file mode 100644 index 000000000..7855c09de --- /dev/null +++ b/start-dev.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ARCH=$(uname -m) + +if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then + echo "Detected Apple Silicon ARM64 — enabling amd64 emulation..." + export DOCKER_PLATFORM="linux/amd64" +else + echo "Detected x86_64 architecture." +fi + +docker-compose -f docker-compose.dev.yml pull fossology_server +docker-compose -f docker-compose.dev.yml up \ No newline at end of file