diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml index 70cca84c5d9..6c70d760967 100644 --- a/.github/workflows/docker-tests.yml +++ b/.github/workflows/docker-tests.yml @@ -41,7 +41,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ./Dockerfile${{ matrix.flavor == 'debian' && '.debian' || '' }} + file: ./build/docker/Dockerfile${{ matrix.flavor == 'debian' && '.debian' || '' }} tags: crowdsecurity/crowdsec:test${{ matrix.flavor == 'full' && '' || '-' }}${{ matrix.flavor == 'full' && '' || matrix.flavor }} target: ${{ matrix.flavor == 'debian' && 'full' || matrix.flavor }} platforms: linux/amd64 @@ -57,17 +57,17 @@ jobs: with: version: 0.5.24 enable-cache: true - cache-dependency-glob: "./docker/test/uv.lock" + cache-dependency-glob: "./build/docker/test/uv.lock" - name: "Set up Python" uses: actions/setup-python@v5 with: - python-version-file: "./docker/test/.python-version" + python-version-file: "./build/docker/test/.python-version" # running serially to reduce test flakiness - name: Lint and run the tests run: | - cd docker/test + cd build/docker/test uv sync --all-extras --dev --locked uv run ruff check uv run basedpyright diff --git a/.github/workflows/publish-docker-master.yml b/.github/workflows/publish-docker-master.yml index e8bfb10ddb1..b48436c12e8 100644 --- a/.github/workflows/publish-docker-master.yml +++ b/.github/workflows/publish-docker-master.yml @@ -6,13 +6,13 @@ on: paths: - 'pkg/**' - 'cmd/**' - - 'mk/**' - - 'docker/docker_start.sh' - - 'docker/config.yaml' + - 'build/**' + - 'build/docker/Dockerfile' + - 'build/docker/Dockerfile.debian' + - 'build/docker/config.yaml' + - 'build/docker/docker_start.sh' - '.github/workflows/publish-docker-master.yml' - '.github/workflows/publish-docker.yml' - - 'Dockerfile' - - 'Dockerfile.debian' - 'go.mod' - 'go.sum' - 'Makefile' diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 11b4401c6da..beb1b50a4dd 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -96,7 +96,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ./Dockerfile${{ inputs.debian && '.debian' || '' }} + file: ./build/docker/Dockerfile${{ inputs.debian && '.debian' || '' }} push: ${{ inputs.push }} tags: ${{ steps.slim.outputs.tags }} target: slim @@ -112,7 +112,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ./Dockerfile${{ inputs.debian && '.debian' || '' }} + file: ./build/docker/Dockerfile${{ inputs.debian && '.debian' || '' }} push: ${{ inputs.push }} tags: ${{ steps.full.outputs.tags }} target: full diff --git a/.github/workflows/update_docker_hub_doc.yml b/.github/workflows/update_docker_hub_doc.yml index 3e2dfa50b0e..73eea8088b3 100644 --- a/.github/workflows/update_docker_hub_doc.yml +++ b/.github/workflows/update_docker_hub_doc.yml @@ -5,7 +5,7 @@ on: branches: - master paths: - - 'docker/README.md' + - 'build/docker/README.md' jobs: update-docker-hub-readme: @@ -26,4 +26,4 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} repository: crowdsecurity/crowdsec short-description: "Crowdsec - An open-source, lightweight agent to detect and respond to bad behaviours." - readme-filepath: "./docker/README.md" + readme-filepath: "./build/docker/README.md" diff --git a/Makefile b/Makefile index 0d3f8d0b5b3..bdbbed5b33f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -include mk/platform.mk -include mk/gmsl +include build/mk/platform.mk +include build/mk/gmsl # By default, this build requires the C++ re2 library to be installed. # @@ -399,4 +399,4 @@ else include test/bats.mk endif -include mk/help.mk +include build/mk/help.mk diff --git a/Dockerfile b/build/docker/Dockerfile similarity index 92% rename from Dockerfile rename to build/docker/Dockerfile index 0226f759750..6da6ae9cebb 100644 --- a/Dockerfile +++ b/build/docker/Dockerfile @@ -40,8 +40,8 @@ RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/co COPY --from=build /go/bin/yq /usr/local/bin/crowdsec /usr/local/bin/cscli /usr/local/bin/ COPY --from=build /etc/crowdsec /staging/etc/crowdsec -COPY --from=build /go/src/crowdsec/docker/docker_start.sh / -COPY --from=build /go/src/crowdsec/docker/config.yaml /staging/etc/crowdsec/config.yaml +COPY --from=build /go/src/crowdsec/build/docker/docker_start.sh / +COPY --from=build /go/src/crowdsec/build/docker/config.yaml /staging/etc/crowdsec/config.yaml COPY --from=build /var/lib/crowdsec /staging/var/lib/crowdsec RUN yq -n '.url="http://0.0.0.0:8080"' | install -m 0600 /dev/stdin /staging/etc/crowdsec/local_api_credentials.yaml diff --git a/Dockerfile.debian b/build/docker/Dockerfile.debian similarity index 93% rename from Dockerfile.debian rename to build/docker/Dockerfile.debian index 70714f624f9..aac3b28c331 100644 --- a/Dockerfile.debian +++ b/build/docker/Dockerfile.debian @@ -56,8 +56,8 @@ RUN apt-get update && \ COPY --from=build /go/bin/yq /usr/local/bin/crowdsec /usr/local/bin/cscli /usr/local/bin/ COPY --from=build /etc/crowdsec /staging/etc/crowdsec -COPY --from=build /go/src/crowdsec/docker/docker_start.sh / -COPY --from=build /go/src/crowdsec/docker/config.yaml /staging/etc/crowdsec/config.yaml +COPY --from=build /go/src/crowdsec/build/docker/docker_start.sh / +COPY --from=build /go/src/crowdsec/build/docker/config.yaml /staging/etc/crowdsec/config.yaml RUN yq -n '.url="http://0.0.0.0:8080"' | install -m 0600 /dev/stdin /staging/etc/crowdsec/local_api_credentials.yaml && \ yq eval -i ".plugin_config.group = \"nogroup\"" /staging/etc/crowdsec/config.yaml diff --git a/docker/README.md b/build/docker/README.md similarity index 99% rename from docker/README.md rename to build/docker/README.md index 0f505f727cb..9a47d9b1d26 100644 --- a/docker/README.md +++ b/build/docker/README.md @@ -48,7 +48,7 @@ You can build your custom images with Dockerfile and Dockerfile-debian. For example, if you need a Debian version without plugin notifiers: ```console -$ docker build -f Dockerfile.debian --target slim . +$ docker build -f build/docker/Dockerfile.debian --target slim . ``` The supported values for target are: full, geoip, plugins, slim. @@ -56,7 +56,7 @@ The supported values for target are: full, geoip, plugins, slim. Note: for crowdsec versions < 1.5.0, the syntax is ```console -$ docker build -f Dockerfile.debian --build-arg=BUILD_ENV=slim . +$ docker build -f build/docker/Dockerfile.debian --build-arg=BUILD_ENV=slim . ``` diff --git a/docker/config.yaml b/build/docker/config.yaml similarity index 100% rename from docker/config.yaml rename to build/docker/config.yaml diff --git a/docker/docker_start.sh b/build/docker/docker_start.sh similarity index 100% rename from docker/docker_start.sh rename to build/docker/docker_start.sh diff --git a/docker/preload-hub-items b/build/docker/preload-hub-items similarity index 100% rename from docker/preload-hub-items rename to build/docker/preload-hub-items diff --git a/docker/test/.python-version b/build/docker/test/.python-version similarity index 100% rename from docker/test/.python-version rename to build/docker/test/.python-version diff --git a/docker/test/README.md b/build/docker/test/README.md similarity index 100% rename from docker/test/README.md rename to build/docker/test/README.md diff --git a/docker/test/default.env b/build/docker/test/default.env similarity index 100% rename from docker/test/default.env rename to build/docker/test/default.env diff --git a/docker/test/pyproject.toml b/build/docker/test/pyproject.toml similarity index 100% rename from docker/test/pyproject.toml rename to build/docker/test/pyproject.toml diff --git a/docker/test/pytest-debug.ini b/build/docker/test/pytest-debug.ini similarity index 100% rename from docker/test/pytest-debug.ini rename to build/docker/test/pytest-debug.ini diff --git a/docker/test/pytest.ini b/build/docker/test/pytest.ini similarity index 100% rename from docker/test/pytest.ini rename to build/docker/test/pytest.ini diff --git a/docker/test/tests/__init__.py b/build/docker/test/tests/__init__.py similarity index 100% rename from docker/test/tests/__init__.py rename to build/docker/test/tests/__init__.py diff --git a/docker/test/tests/conftest.py b/build/docker/test/tests/conftest.py similarity index 100% rename from docker/test/tests/conftest.py rename to build/docker/test/tests/conftest.py diff --git a/docker/test/tests/test_agent.py b/build/docker/test/tests/test_agent.py similarity index 100% rename from docker/test/tests/test_agent.py rename to build/docker/test/tests/test_agent.py diff --git a/docker/test/tests/test_agent_only.py b/build/docker/test/tests/test_agent_only.py similarity index 100% rename from docker/test/tests/test_agent_only.py rename to build/docker/test/tests/test_agent_only.py diff --git a/docker/test/tests/test_bouncer.py b/build/docker/test/tests/test_bouncer.py similarity index 100% rename from docker/test/tests/test_bouncer.py rename to build/docker/test/tests/test_bouncer.py diff --git a/docker/test/tests/test_capi.py b/build/docker/test/tests/test_capi.py similarity index 100% rename from docker/test/tests/test_capi.py rename to build/docker/test/tests/test_capi.py diff --git a/docker/test/tests/test_capi_whitelists.py b/build/docker/test/tests/test_capi_whitelists.py similarity index 100% rename from docker/test/tests/test_capi_whitelists.py rename to build/docker/test/tests/test_capi_whitelists.py diff --git a/docker/test/tests/test_cold_logs.py b/build/docker/test/tests/test_cold_logs.py similarity index 100% rename from docker/test/tests/test_cold_logs.py rename to build/docker/test/tests/test_cold_logs.py diff --git a/docker/test/tests/test_flavors.py b/build/docker/test/tests/test_flavors.py similarity index 100% rename from docker/test/tests/test_flavors.py rename to build/docker/test/tests/test_flavors.py diff --git a/docker/test/tests/test_hello.py b/build/docker/test/tests/test_hello.py similarity index 100% rename from docker/test/tests/test_hello.py rename to build/docker/test/tests/test_hello.py diff --git a/docker/test/tests/test_hub.py b/build/docker/test/tests/test_hub.py similarity index 100% rename from docker/test/tests/test_hub.py rename to build/docker/test/tests/test_hub.py diff --git a/docker/test/tests/test_hub_collections.py b/build/docker/test/tests/test_hub_collections.py similarity index 100% rename from docker/test/tests/test_hub_collections.py rename to build/docker/test/tests/test_hub_collections.py diff --git a/docker/test/tests/test_hub_parsers.py b/build/docker/test/tests/test_hub_parsers.py similarity index 100% rename from docker/test/tests/test_hub_parsers.py rename to build/docker/test/tests/test_hub_parsers.py diff --git a/docker/test/tests/test_hub_postoverflows.py b/build/docker/test/tests/test_hub_postoverflows.py similarity index 100% rename from docker/test/tests/test_hub_postoverflows.py rename to build/docker/test/tests/test_hub_postoverflows.py diff --git a/docker/test/tests/test_hub_scenarios.py b/build/docker/test/tests/test_hub_scenarios.py similarity index 100% rename from docker/test/tests/test_hub_scenarios.py rename to build/docker/test/tests/test_hub_scenarios.py diff --git a/docker/test/tests/test_local_api_url.py b/build/docker/test/tests/test_local_api_url.py similarity index 100% rename from docker/test/tests/test_local_api_url.py rename to build/docker/test/tests/test_local_api_url.py diff --git a/docker/test/tests/test_local_item.py b/build/docker/test/tests/test_local_item.py similarity index 100% rename from docker/test/tests/test_local_item.py rename to build/docker/test/tests/test_local_item.py diff --git a/docker/test/tests/test_metrics.py b/build/docker/test/tests/test_metrics.py similarity index 100% rename from docker/test/tests/test_metrics.py rename to build/docker/test/tests/test_metrics.py diff --git a/docker/test/tests/test_nolapi.py b/build/docker/test/tests/test_nolapi.py similarity index 100% rename from docker/test/tests/test_nolapi.py rename to build/docker/test/tests/test_nolapi.py diff --git a/docker/test/tests/test_simple.py b/build/docker/test/tests/test_simple.py similarity index 100% rename from docker/test/tests/test_simple.py rename to build/docker/test/tests/test_simple.py diff --git a/docker/test/tests/test_tls.py b/build/docker/test/tests/test_tls.py similarity index 100% rename from docker/test/tests/test_tls.py rename to build/docker/test/tests/test_tls.py diff --git a/docker/test/tests/test_version.py b/build/docker/test/tests/test_version.py similarity index 100% rename from docker/test/tests/test_version.py rename to build/docker/test/tests/test_version.py diff --git a/docker/test/tests/test_wal.py b/build/docker/test/tests/test_wal.py similarity index 100% rename from docker/test/tests/test_wal.py rename to build/docker/test/tests/test_wal.py diff --git a/docker/test/uv.lock b/build/docker/test/uv.lock similarity index 100% rename from docker/test/uv.lock rename to build/docker/test/uv.lock diff --git a/mk/__gmsl b/build/mk/__gmsl similarity index 100% rename from mk/__gmsl rename to build/mk/__gmsl diff --git a/mk/gmsl b/build/mk/gmsl similarity index 100% rename from mk/gmsl rename to build/mk/gmsl diff --git a/mk/gmsl.html b/build/mk/gmsl.html similarity index 100% rename from mk/gmsl.html rename to build/mk/gmsl.html diff --git a/mk/help.mk b/build/mk/help.mk similarity index 100% rename from mk/help.mk rename to build/mk/help.mk diff --git a/mk/platform.mk b/build/mk/platform.mk similarity index 62% rename from mk/platform.mk rename to build/mk/platform.mk index b639723b612..55777e3701e 100644 --- a/mk/platform.mk +++ b/build/mk/platform.mk @@ -10,11 +10,11 @@ ifeq ($(OS), Windows_NT) EXT = .exe else SYSTEM ?= $(shell uname -s | tr '[A-Z]' '[a-z]') - include mk/platform/unix_common.mk + include build/mk/platform/unix_common.mk endif -ifneq ("$(wildcard mk/platform/$(SYSTEM).mk)", "") - include mk/platform/$(SYSTEM).mk +ifneq ("$(wildcard build/mk/platform/$(SYSTEM).mk)", "") + include build/mk/platform/$(SYSTEM).mk else - include mk/platform/linux.mk + include build/mk/platform/linux.mk endif diff --git a/mk/platform/freebsd.mk b/build/mk/platform/freebsd.mk similarity index 100% rename from mk/platform/freebsd.mk rename to build/mk/platform/freebsd.mk diff --git a/mk/platform/linux.mk b/build/mk/platform/linux.mk similarity index 100% rename from mk/platform/linux.mk rename to build/mk/platform/linux.mk diff --git a/mk/platform/openbsd.mk b/build/mk/platform/openbsd.mk similarity index 100% rename from mk/platform/openbsd.mk rename to build/mk/platform/openbsd.mk diff --git a/mk/platform/unix_common.mk b/build/mk/platform/unix_common.mk similarity index 100% rename from mk/platform/unix_common.mk rename to build/mk/platform/unix_common.mk diff --git a/mk/platform/windows.mk b/build/mk/platform/windows.mk similarity index 100% rename from mk/platform/windows.mk rename to build/mk/platform/windows.mk