From e6fe17dbf7c0d151dcfde64311aed053a83ba58f Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 1 Jul 2024 14:33:06 -0700 Subject: [PATCH] Add host mapping --- .../generator/docker/DockerComposeGenerator.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/org/lflang/generator/docker/DockerComposeGenerator.java b/core/src/main/java/org/lflang/generator/docker/DockerComposeGenerator.java index 08b0df23c6..2ac6c9fa63 100644 --- a/core/src/main/java/org/lflang/generator/docker/DockerComposeGenerator.java +++ b/core/src/main/java/org/lflang/generator/docker/DockerComposeGenerator.java @@ -62,10 +62,20 @@ protected String getServiceDescription(DockerData data) { context: "%s" container_name: "%s" tty: true + extra_hosts: + - "host.docker.internal:host-gateway" + environment: + LF_TELEGRAF_HOST_NAME: ${LF_TELEGRAF_HOST_NAME:-host.docker.internal} """ .formatted(getServiceName(data), getBuildContext(data), getContainerName(data)); } + private String getEnvironmentFile() { + // FIXME: add target property env-files + var file = ".env"; + return "env-file: \"%s\"".formatted(file); + } + /** Return the name of the service represented by the given data. */ protected String getServiceName(DockerData data) { return "main";