@forge/cli-shared
9.8.0-next.59.8.0-next.6
out/tunnel/docker-compose-lifecycle.js~
out/tunnel/docker-compose-lifecycle.jsModified+9−8
Index: package/out/tunnel/docker-compose-lifecycle.js
===================================================================
--- package/out/tunnel/docker-compose-lifecycle.js
+++ package/out/tunnel/docker-compose-lifecycle.js
@@ -9,11 +9,13 @@
const docker_compose_1 = require("docker-compose");
const shared_1 = require("../shared");
const text_1 = require("../ui/text");
const tunnel_options_1 = require("./tunnel-options");
-const HIDDEN_DIR = '.services';
+const SERVICES_DIR_NAME = 'services';
+const HIDDEN_DIR = path.join(shared_1.FORGE_DIRECTORY, SERVICES_DIR_NAME);
exports.PROXY_SIDECAR_VOLUME_DIR = '/forge/container';
-exports.CONTAINER_SERVICE_ASSETS = '.container-service-assets';
+const CONTAINER_SERVICE_ASSETS_DIR_NAME = 'container-service-assets';
+exports.CONTAINER_SERVICE_ASSETS = path.join(shared_1.FORGE_DIRECTORY, CONTAINER_SERVICE_ASSETS_DIR_NAME);
exports.K8S_AUTH_TOKEN_FILENAME = 'local-account';
const PROXY_SIDECAR_SERVICE_NAME = 'proxy-sidecar';
const PROXY_SIDECAR_IMAGE_PATH = 'forge-platform/proxy-sidecar:latest';
const PROXY_SIDECAR_REGISTRIES = {
@@ -127,17 +129,16 @@
}
return filesGenerated;
};
exports.generateContainersDockerComposeFile = generateContainersDockerComposeFile;
+const relativeComposePath = (from, to) => path.relative(from, to).split(path.sep).join('/');
const adjustFilePath = (filePath) => {
if (path.isAbsolute(filePath)) {
return filePath;
}
- let adjusted = filePath;
- if (adjusted.startsWith('./')) {
- adjusted = adjusted.slice(2);
- }
- return path.join('..', adjusted);
+ const composeFileDir = path.join(process.cwd(), HIDDEN_DIR);
+ const absoluteTarget = path.resolve(process.cwd(), filePath);
+ return relativeComposePath(composeFileDir, absoluteTarget);
};
const getProxySidecarConfig = async (serviceKey, containerKeys, port, appId, envId, serviceIndex, healthEndpointPath) => {
let fopBaseUrl = 'https://forge-outbound-proxy.services.atlassian.com';
let jwksUrl = 'https://forge.cdn.prod.atlassian-dev.net/.well-known/jwks.json';
@@ -163,9 +164,9 @@
`IS_LOCAL_DEV=true`,
`K8S_AUTH_TOKEN_PATH=${exports.PROXY_SIDECAR_VOLUME_DIR}/${exports.K8S_AUTH_TOKEN_FILENAME}`,
`${containerKeys[0]}_CONTAINER_HEALTHCHECK=http://${containerKeys[0]}:8080${healthEndpointPath}`
],
- volumes: [`../${exports.CONTAINER_SERVICE_ASSETS}:${exports.PROXY_SIDECAR_VOLUME_DIR}:ro`],
+ volumes: [`${adjustFilePath(exports.CONTAINER_SERVICE_ASSETS)}:${exports.PROXY_SIDECAR_VOLUME_DIR}:ro`],
ports: [
`${port}:${tunnel_options_1.DEFAULT_PROXY_INGRESS_PORT}`,
`${tunnel_options_1.DEFAULT_PROXY_HEALTHCHECK_PORT_HOST_MACHINE + serviceIndex}:${tunnel_options_1.DEFAULT_PROXY_HEALTHCHECK_PORT}`
]