From a234b8772082cf84fc96b2f466c8f48c4a726c8a Mon Sep 17 00:00:00 2001
From: Jose Carlos Luna <Jose.Carlos.Luna@cern.ch>
Date: Fri, 10 May 2024 17:38:23 +0200
Subject: [PATCH] docker compose example for using the binary directly

---
 docker-compose-inline.yml | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 docker-compose-inline.yml

diff --git a/docker-compose-inline.yml b/docker-compose-inline.yml
new file mode 100644
index 0000000..92795a4
--- /dev/null
+++ b/docker-compose-inline.yml
@@ -0,0 +1,34 @@
+#Requires docker compose v2 (https://docs.docker.com/compose/install/linux/)
+#Logging to journald to avoid losing the logs, can check with journalctl CONTAINER_NAME=gocanary
+services:
+   gocanary:
+      build: 
+        context: .
+        dockerfile_inline: |
+          FROM scratch
+          WORKDIR /canary
+          COPY gocanary /canary
+          EXPOSE 443
+          EXPOSE 80
+          EXPOSE 53/tcp
+          EXPOSE 53/udp
+          ENTRYPOINT ["./gocanary", "--enable-hardening=false", "--enable-https=true", "--autocert-domain=REPLACE_DOMAIN"]
+        #Or for cert.key and cert.pem
+        #ENTRYPOINT ["./gocanary", "--enable-hardening=false", "--enable-https=true"]
+      ports:
+        - "REPLACE_PUBLIC_IP:53:53/udp"
+        - "REPLACE_PUBLIC_IP:53:53/tcp"
+        - "REPLACE_PUBLIC_IP:443:443"
+        - "REPLACE_PUBLIC_IP:80:80"
+      volumes:
+        - ./canary.yaml:/canary/canary.yaml
+        - ./config.yaml:/canary/config.yaml
+        #For let's encrypt certificates
+        - ./cache:/canary/cache
+        #Or use generated certs
+        #- ./cert.key:/canary/cert.key
+        #- ./cert.pem:/canary/cert.pem
+      container_name: gocanary
+      restart: always
+      logging:
+        driver: "journald"
\ No newline at end of file
-- 
GitLab