Skip to content

Commit

Permalink
Streamline image building process.
Browse files Browse the repository at this point in the history
- Add new registry URLs.
- Simplify node building process.
- Update documentation.
  • Loading branch information
GJFR committed Feb 17, 2024
1 parent 17f2088 commit 4076b6c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
FROM python:3.11-slim-buster AS base
FROM node:lts-alpine as ui-build-stage
WORKDIR /app
COPY /bci/ui/frontend/package*.json ./
RUN npm install
COPY /bci/ui/frontend ./
RUN npm run build


FROM python:3.11-slim-buster AS base
WORKDIR /app

RUN apt-get update -y
Expand Down Expand Up @@ -71,6 +78,7 @@ RUN mkdir -p $HOME/.pki/nssdb && \
# RUN echo "tls_version_client_min: UNBOUND" > /home/bci/.mitmproxy/config.yaml && \
# echo "tls_version_server_min: UNBOUND" >> /home/bci/.mitmproxy/config.yaml && \
# echo "listen_port: 8081" >> /home/bci/.mitmproxy/config.yaml
COPY --from=ui-build-stage /app/dist /app/bci/ui/frontend/dist


FROM base AS core
Expand All @@ -79,11 +87,13 @@ COPY bci /app/bci
COPY analysis /app/analysis
ENTRYPOINT [ "/app/scripts/boot/core.sh" ]


FROM base AS worker
# Copy rest of source code
COPY bci /app/bci
ENTRYPOINT [ "/app/scripts/boot/worker.sh" ]


FROM base AS dev
COPY requirements_dev.txt /app/requirements_dev.txt
RUN pip install --user -r requirements_dev.txt
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ BugHog can be installed by following the steps below:
If you want to modify the source code, use the following commands to build the necessary Docker images.
Run this script again if you make changes to the source code.
```bash
docker compose up node_install_deps
docker compose up node_build
docker compose build core worker web
```

Expand All @@ -65,7 +63,7 @@ If you switch between pulled and built images, make sure to execute the appropri
docker compose up core web
```

Open your web browser and navigate to http://localhost:5000 to access the graphical interface.
Open your web browser and navigate to [http://localhost:5000](http://localhost:5000) to access the graphical interface.
If you started BugHog on a remote server, replace localhost with its IP address.

> :warning: BugHog's own MongoDB instance will persist data within the [database](database) folder.
Expand All @@ -77,7 +75,7 @@ By default, BugHog uses a MongoDB container.
you might want to prefer all data to be stored on your own MongoDB instance.
If you prefer storing data in your own MongoDB instance, follow these steps:
1. Create a `.env` file from `.env.example` (both in the `config` folder) and fill in the missing values.
1. Create a `.env` file from `.env.example` (both in the [config](config) folder) and fill in the missing values.
2. (Re)start BugHog.
Expand All @@ -98,6 +96,18 @@ docker compose down
docker compose up core web
```
### Development
For extending or debugging the Vue UI, the most convenient approach is to launch an interactive Node environment.
The UI can be visited at [http://localhost:5173](http://localhost:5173).
```bash
docker compose up node_dev
```
For debugging the core application, consider using the VS Code dev container for an effortless debugging experience.
You can utilize the configuration in [.devcontainer](.devcontainer) for this.
## Additional help
Don't hesitate to open a [GitHub issue](https://github.com/DistriNet/BugHog/issues/new) if you come across a bug, want to suggest a feature, or have any questions!
19 changes: 4 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ services:
build:
context: .
target: core
image: registry.gitlab.kuleuven.be/distrinet/research/bughog/core/core:latest
pull_policy: if_not_present
shm_size: '2gb'
networks:
Expand Down Expand Up @@ -59,14 +58,15 @@ services:

core:
extends: base
image: registry.gitlab.kuleuven.be/distrinet/research/bughog/app/core
hostname: bh_core

worker:
extends: base
image: registry.gitlab.kuleuven.be/distrinet/research/bughog/app/worker
build:
context: .
target: worker
image: registry.gitlab.kuleuven.be/distrinet/research/bughog/core/worker:latest
pull_policy: if_not_present
hostname: bh_worker
container_name: bh_worker
Expand All @@ -76,7 +76,7 @@ services:
#===================#

web:
image: "registry.gitlab.kuleuven.be/distrinet/research/bughog/experiment-server:latest"
image: registry.gitlab.kuleuven.be/distrinet/research/bughog/experiment-server
pull_policy: if_not_present
volumes:
- ./experiments/pages:/experiments/pages:ro
Expand All @@ -99,26 +99,15 @@ services:
# NODE FRONT END #
#================#

node_base:
node_dev:
image: node:lts-alpine
ports:
- "5173:5173"
volumes:
- ./bci/ui/frontend:/app
working_dir: /app

node_install_deps:
extends: node_base
entrypoint: ["npm", "install"]

node_dev:
extends: node_base
entrypoint: ["npm", "run", "dev", "--", "--host"]

node_build:
extends: node_base
entrypoint: ["npm", "run", "build"]

networks:
bh_net:
name: bh_net

0 comments on commit 4076b6c

Please sign in to comment.