Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 22 additions & 36 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# FOSSology docker-compose file

# Copyright (C) 2022 Vineet Vatsal ([email protected])

# 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"

Expand All @@ -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:
13 changes: 13 additions & 0 deletions start-dev.sh
Original file line number Diff line number Diff line change
@@ -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