Skip to content
Merged
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
32 changes: 32 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to put this env var despite docker warnings since DD made it mandatory

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