From 8c5d2be1a5464a6bd7e2c034849a927b5a207988 Mon Sep 17 00:00:00 2001 From: michael inthilith Date: Fri, 5 Sep 2025 10:33:37 +0200 Subject: [PATCH 1/2] chore(ci): add Dockerfile --- Dockerfile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b59f320a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +# Build stage +FROM golang:1.25-trixie AS builder + +WORKDIR /app + +# Copy Go module files +COPY go.mod go.sum ./ + +RUN go mod download + +COPY . . + +RUN go build -o smokescreen main.go + +# Runtime stage +FROM debian:trixie-slim + +WORKDIR /app + +# Copy binary from builder stage +COPY --from=builder /app/smokescreen ./ + +ARG DD_API_KEY=replace_with_your_api_key_if_needed +ENV DD_API_KEY=${DD_API_KEY} +ENV DD_AGENT_MAJOR_VERSION=7 +ENV DD_INSTALL_ONLY=true + +RUN apt-get update && apt-get install -y curl bash && \ + bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script_agent7.sh)" && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +ENV DD_SITE=datadoghq.eu +ENV DD_LOGS_ENABLED=true +ENV DD_SERVICE=smokescreen +ENV DD_VERSION=1.0.0 +ENV DD_ENV=production +ENV DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true + +EXPOSE 4750 + +ENV DD_HOSTNAME=smokescreen-container + +RUN echo '#!/bin/bash' > /start.sh && \ + echo 'export DD_HOSTNAME=${DD_HOSTNAME:-$(hostname)}' >> /start.sh && \ + echo '/opt/datadog-agent/bin/agent/agent run > /dev/null 2>&1 &' >> /start.sh && \ + echo 'sleep 2' >> /start.sh && \ + echo 'exec ./smokescreen --statsd-address localhost:8125 ' >> /start.sh && \ + chmod +x /start.sh + +CMD ["/start.sh"] + + From b8f993471cbeee499c1dddc58295b0f445438585 Mon Sep 17 00:00:00 2001 From: michael inthilith Date: Fri, 5 Sep 2025 10:46:28 +0200 Subject: [PATCH 2/2] chore(ci): add action to build a push image --- .github/workflows/docker.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..2e4a9eab --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,32 @@ +name: build-and-push-docker-images + +on: + workflow_dispatch: + push: + branches: ["master"] + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2 + - name: Login to the GitHub container registry + uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4 + with: + push: true + tags: ghcr.io/tryriot/smokescreen:latest