Closed utgarda closed 4 weeks ago
Agreed switching to full debian makes more sense as the default (will accept PR).
however, the health check is too opinionated imo for the default image. Should be left up to the user's own infrastructure / requirements
seems easy enough to wrap the base image if wanting to use the Docker provided healthcheck
FROM gateway:latest
HEALTHCHECK --interval=1m --start-period=1m --start-interval=5s CMD curl -f localhost:8080/v2/positions || exit 1
Indeed, healthcheck can be put in compose.yaml
, but the supported way to do so relies on shell tools in the container itself and that will require to alter the image to install curl at least.
I'll dig some more
I found a way to add curl
to the current Gateway image by adding a Dockerfile to my compose configurations, similar to
FROM drift-gateway
RUN apt-get update && apt-get install -y curl && rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
HEALTHCHECK --interval=30s --start-period=1m --start-interval=5s CMD curl -f localhost:8080/v2/positions || exit 1
then using it in a service definition
services:
gateway:
build: ./docker/gateway
docker compose up --build
# Attaching to gateway-1, bot-1
# gateway-1 | [2024-08-20T13:42:18Z INFO gateway] 🏛 gateway listening at http://0.0.0.0:8080
# gateway-1 | [2024-08-20T13:42:18Z INFO gateway] 🪪: authority: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, default sub-account: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
# gateway-1 | [2024-08-20T13:42:19Z INFO gateway] 127.0.0.1 | 200 | GET /v2/positions HTTP/1.1 | (368.316764ms)
Now I'm quite happy with just having debian:12
as base image, sending that PR!
@jordy25519 would you be OK with adding curl to the image?
RUN apt-get update && apt-get install -y curl && rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
it sounds good, can include curl
in the PR
it sounds good, can include
curl
in the PR
done
closed in #68
Feature request: Add healthcheck to Dockerfile for Drift Gateway
Description
The current Dockerfile uses
gcr.io/distroless/base-debian12
, which lacks a shell and network tools likecurl
. This complicates running Drift Gateway in Docker Compose, as other services need a way to verify the Gateway is running.Proposal
Switch to
debian:12
withcurl
installed and add a health check. At this stage, a functional image with tools is more beneficial than a size-optimized one.Current Dockerfile
Proposed Dockerfile
Benefits