From 48f6e1f7836770b6319407cb8a4b52be1b4a2b25 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Wed, 18 Feb 2026 02:58:32 -0500 Subject: [PATCH] Migrate build assets and scripts to `deploy/docker` structure - Removed `install.sh` and moved Docker-related assets to `deploy/docker`. - Updated all Dockerfile references from `build/` to `deploy/docker/`. - Refactored paths in E2E tests, Makefile, and documentation for consistency with new directory structure. - Added `HAPROXY_STATS_CORS_ORIGIN` environment variable in `docker-compose.yml`. --- .github/workflows/build.yml | 2 +- Makefile | 2 +- RELEASE.md | 2 +- build-multiarch.sh | 2 +- {build => deploy/docker}/Dockerfile | 3 +- {build => deploy/docker/assets}/entrypoint.sh | 0 .../etc/easyhaproxy/haproxy/conf.d/README.md | 0 .../haproxy/errors-custom/400.http | 0 .../haproxy/errors-custom/403.http | 0 .../haproxy/errors-custom/408.http | 0 .../haproxy/errors-custom/500.http | 0 .../haproxy/errors-custom/502.http | 0 .../haproxy/errors-custom/503.http | 0 .../haproxy/errors-custom/504.http | 0 deploy/docker/docker-compose.yml | 1 + deploy/docker/install.sh | 29 ------------------- tests_e2e/docker/AGENTS.md | 2 +- tests_e2e/docker/docker-compose-acme-e2e.yml | 2 +- .../docker/docker-compose-changed-label.yml | 2 +- .../docker/docker-compose-cloudflare.yml | 2 +- .../docker/docker-compose-ip-whitelist.yml | 2 +- .../docker/docker-compose-jwt-validator.yml | 2 +- .../docker-compose-multi-containers.yml | 2 +- tests_e2e/docker/docker-compose-php-fpm.yml | 2 +- .../docker-compose-plugins-combined.yml | 2 +- .../docker/docker-compose-proxy-headers.yml | 2 +- tests_e2e/docker/docker-compose.yml | 2 +- tests_e2e/kubernetes/setup-cluster.sh | 2 +- tests_e2e/static/docker-compose.yml | 2 +- tests_e2e/test_kubernetes.py | 2 +- 30 files changed, 20 insertions(+), 49 deletions(-) rename {build => deploy/docker}/Dockerfile (96%) rename {build => deploy/docker/assets}/entrypoint.sh (100%) mode change 100644 => 100755 rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/conf.d/README.md (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/400.http (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/403.http (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/408.http (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/500.http (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/502.http (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/503.http (100%) rename {build => deploy/docker}/assets/etc/easyhaproxy/haproxy/errors-custom/504.http (100%) delete mode 100755 deploy/docker/install.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 433a875..8625a50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -201,7 +201,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - file: build/Dockerfile + file: deploy/docker/Dockerfile build-args: | RELEASE_VERSION_ARG="${{ steps.tags.outputs.result }}" platforms: linux/amd64,linux/arm64 diff --git a/Makefile b/Makefile index 4d38e9e..3a3a8d7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION := $(shell git rev-parse --short HEAD) .PHONY: build build: - docker build -t byjg/easy-haproxy --build-arg RELEASE_VERSION_ARG="$(VERSION)" -t byjg/easy-haproxy:local -f build/Dockerfile . + docker build -t byjg/easy-haproxy --build-arg RELEASE_VERSION_ARG="$(VERSION)" -t byjg/easy-haproxy:local -f deploy/docker/Dockerfile . .PHONY: test test: diff --git a/RELEASE.md b/RELEASE.md index 56cae04..476ac1b 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -80,7 +80,7 @@ The automated release process is triggered by pushing a semantic version tag. ```bash make build # Or manually: - docker build -t byjg/easy-haproxy:local -f build/Dockerfile . + docker build -t byjg/easy-haproxy:local -f deploy/docker/Dockerfile . ``` ### Step 2: Bump Versions (script + PR) diff --git a/build-multiarch.sh b/build-multiarch.sh index 716412b..cfeae5a 100755 --- a/build-multiarch.sh +++ b/build-multiarch.sh @@ -17,7 +17,7 @@ podman run --rm --events-backend=file --cgroup-manager=cgroupfs --privileged doc for VERSION in $VERSIONS do - DOCKERFILE=build/Dockerfile + DOCKERFILE=deploy/docker/Dockerfile buildah manifest create byjg/easy-haproxy:$VERSION diff --git a/build/Dockerfile b/deploy/docker/Dockerfile similarity index 96% rename from build/Dockerfile rename to deploy/docker/Dockerfile index 500359e..1c6a125 100644 --- a/build/Dockerfile +++ b/deploy/docker/Dockerfile @@ -43,8 +43,7 @@ RUN apk add --no-cache certbot openssl bash curl su-exec \ && cat /tmp/placeholder.crt /tmp/placeholder.key > /etc/easyhaproxy/certs/haproxy/placeholder.pem \ && rm /tmp/placeholder.key /tmp/placeholder.crt -COPY build/assets / -COPY build/entrypoint.sh /entrypoint.sh +COPY deploy/docker/assets / COPY --from=builder /scripts /scripts RUN chmod +x /entrypoint.sh \ diff --git a/build/entrypoint.sh b/deploy/docker/assets/entrypoint.sh old mode 100644 new mode 100755 similarity index 100% rename from build/entrypoint.sh rename to deploy/docker/assets/entrypoint.sh diff --git a/build/assets/etc/easyhaproxy/haproxy/conf.d/README.md b/deploy/docker/assets/etc/easyhaproxy/haproxy/conf.d/README.md similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/conf.d/README.md rename to deploy/docker/assets/etc/easyhaproxy/haproxy/conf.d/README.md diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/400.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/400.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/400.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/400.http diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/403.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/403.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/403.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/403.http diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/408.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/408.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/408.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/408.http diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/500.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/500.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/500.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/500.http diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/502.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/502.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/502.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/502.http diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/503.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/503.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/503.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/503.http diff --git a/build/assets/etc/easyhaproxy/haproxy/errors-custom/504.http b/deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/504.http similarity index 100% rename from build/assets/etc/easyhaproxy/haproxy/errors-custom/504.http rename to deploy/docker/assets/etc/easyhaproxy/haproxy/errors-custom/504.http diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml index da6cf90..8fe6904 100644 --- a/deploy/docker/docker-compose.yml +++ b/deploy/docker/docker-compose.yml @@ -20,6 +20,7 @@ services: HAPROXY_USERNAME: admin HAPROXY_PASSWORD: password HAPROXY_STATS_PORT: 1936 + HAPROXY_STATS_CORS_ORIGIN: "http://localhost:8080" ports: - "80:80/tcp" diff --git a/deploy/docker/install.sh b/deploy/docker/install.sh deleted file mode 100755 index 347ded6..0000000 --- a/deploy/docker/install.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -ASSETS_DIR="$(dirname "${BASH_SOURCE[0]}")"/../../build/assets/certs/haproxy - -docker network create easyhaproxy -docker volume create certs_certbot -docker volume create certs_haproxy - -docker run -d --rm --name easyhaproxy_install -v certs_haproxy:/certs alpine tail -f /dev/null -docker cp $ASSETS_DIR/place_holder_cert.pem easyhaproxy_install:/certs/place_holder_cert.pem -docker stop easyhaproxy_install - -echo -echo -echo make sure to add to all of your containers: -echo -echo docker-compose -echo ============== -echo "networks:" -echo " default:" -echo " name: easyhaproxy" -echo " external: true" - -echo -echo -echo docker run -echo ============== -echo docker run ... --network easyhaproxy ... your_image:tag -echo \ No newline at end of file diff --git a/tests_e2e/docker/AGENTS.md b/tests_e2e/docker/AGENTS.md index d2b03b0..6c0c749 100644 --- a/tests_e2e/docker/AGENTS.md +++ b/tests_e2e/docker/AGENTS.md @@ -13,6 +13,6 @@ 1. Investigate the source code in src/* 2. Try to fix it. -3. After the code is changed, build it again: `docker build -t byjg/easy-haproxy:5.0.0 -f build/Dockerfile --no-cache .` and start the tests again. +3. After the code is changed, build it again: `docker build -t byjg/easy-haproxy:5.0.0 -f deploy/docker/Dockerfile --no-cache .` and start the tests again. diff --git a/tests_e2e/docker/docker-compose-acme-e2e.yml b/tests_e2e/docker/docker-compose-acme-e2e.yml index 21bc259..557d469 100644 --- a/tests_e2e/docker/docker-compose-acme-e2e.yml +++ b/tests_e2e/docker/docker-compose-acme-e2e.yml @@ -96,7 +96,7 @@ services: haproxy: build: context: ../.. - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile depends_on: pebble_health: condition: service_healthy diff --git a/tests_e2e/docker/docker-compose-changed-label.yml b/tests_e2e/docker/docker-compose-changed-label.yml index 70ea7a7..91d8f26 100644 --- a/tests_e2e/docker/docker-compose-changed-label.yml +++ b/tests_e2e/docker/docker-compose-changed-label.yml @@ -35,7 +35,7 @@ services: haproxy: build: context: ../../ - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-cloudflare.yml b/tests_e2e/docker/docker-compose-cloudflare.yml index 73f0d37..8a7601d 100644 --- a/tests_e2e/docker/docker-compose-cloudflare.yml +++ b/tests_e2e/docker/docker-compose-cloudflare.yml @@ -48,7 +48,7 @@ services: haproxy: build: context: ../.. - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-ip-whitelist.yml b/tests_e2e/docker/docker-compose-ip-whitelist.yml index 56da952..97b1517 100644 --- a/tests_e2e/docker/docker-compose-ip-whitelist.yml +++ b/tests_e2e/docker/docker-compose-ip-whitelist.yml @@ -44,7 +44,7 @@ services: haproxy: build: context: ../../ - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-jwt-validator.yml b/tests_e2e/docker/docker-compose-jwt-validator.yml index d6d895c..16e3c7a 100644 --- a/tests_e2e/docker/docker-compose-jwt-validator.yml +++ b/tests_e2e/docker/docker-compose-jwt-validator.yml @@ -52,7 +52,7 @@ services: haproxy: build: context: ../.. - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-multi-containers.yml b/tests_e2e/docker/docker-compose-multi-containers.yml index 98b2090..9e2c948 100644 --- a/tests_e2e/docker/docker-compose-multi-containers.yml +++ b/tests_e2e/docker/docker-compose-multi-containers.yml @@ -48,7 +48,7 @@ services: haproxy: build: context: ../../ - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-php-fpm.yml b/tests_e2e/docker/docker-compose-php-fpm.yml index e160a1b..20edeb6 100644 --- a/tests_e2e/docker/docker-compose-php-fpm.yml +++ b/tests_e2e/docker/docker-compose-php-fpm.yml @@ -46,7 +46,7 @@ services: haproxy: build: context: ../../ - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-plugins-combined.yml b/tests_e2e/docker/docker-compose-plugins-combined.yml index 197d231..5594f7f 100644 --- a/tests_e2e/docker/docker-compose-plugins-combined.yml +++ b/tests_e2e/docker/docker-compose-plugins-combined.yml @@ -64,7 +64,7 @@ services: haproxy: build: context: ../../ - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose-proxy-headers.yml b/tests_e2e/docker/docker-compose-proxy-headers.yml index cf71858..84b96c1 100644 --- a/tests_e2e/docker/docker-compose-proxy-headers.yml +++ b/tests_e2e/docker/docker-compose-proxy-headers.yml @@ -17,7 +17,7 @@ services: haproxy: build: context: ../.. - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/docker/docker-compose.yml b/tests_e2e/docker/docker-compose.yml index 9669744..14acd52 100644 --- a/tests_e2e/docker/docker-compose.yml +++ b/tests_e2e/docker/docker-compose.yml @@ -50,7 +50,7 @@ services: haproxy: build: context: ../.. - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile image: byjg/easy-haproxy:local volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/tests_e2e/kubernetes/setup-cluster.sh b/tests_e2e/kubernetes/setup-cluster.sh index 498fcc9..7b90c39 100755 --- a/tests_e2e/kubernetes/setup-cluster.sh +++ b/tests_e2e/kubernetes/setup-cluster.sh @@ -109,7 +109,7 @@ echo -e "${GREEN}✓ kind cluster '${CLUSTER_NAME}' is ready${NC}" # Build and load local EasyHAProxy image echo -e "${BLUE}[4/9] Building local EasyHAProxy image (may take 30-60s)...${NC}" docker build -t byjg/easy-haproxy:local \ - -f "${PROJECT_ROOT}/build/Dockerfile" \ + -f "${PROJECT_ROOT}/deploy/docker/Dockerfile" \ "${PROJECT_ROOT}" echo -e "${BLUE}[5/9] Loading image into kind cluster (may take 10-20s)...${NC}" diff --git a/tests_e2e/static/docker-compose.yml b/tests_e2e/static/docker-compose.yml index 832d2b4..f4d9889 100644 --- a/tests_e2e/static/docker-compose.yml +++ b/tests_e2e/static/docker-compose.yml @@ -63,7 +63,7 @@ services: image: byjg/easy-haproxy:local build: context: ../.. - dockerfile: build/Dockerfile + dockerfile: deploy/docker/Dockerfile volumes: - ./conf/:/etc/easyhaproxy/static/ - ../static/host1.local.pem:/etc/easyhaproxy/certs/haproxy/host1.local.pem:ro diff --git a/tests_e2e/test_kubernetes.py b/tests_e2e/test_kubernetes.py index 0ef343b..0a4f8b6 100644 --- a/tests_e2e/test_kubernetes.py +++ b/tests_e2e/test_kubernetes.py @@ -326,7 +326,7 @@ nodes: project_root = BASE_DIR.parent subprocess.run( ["docker", "build", "-t", "byjg/easy-haproxy:local", - "-f", str(project_root / "build" / "Dockerfile"), + "-f", str(project_root / "deploy" / "docker" / "Dockerfile"), str(project_root)], check=True, capture_output=True,