Skip to content

Commit

Permalink
chore: debug ci
Browse files Browse the repository at this point in the history
  • Loading branch information
viraj124 committed Feb 12, 2025
1 parent 32dc415 commit 981b7db
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions packages/integration-tests/docker-setup/docker.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { StartedPostgreSqlContainer } from '@testcontainers/postgresql';
import { PostgreSqlContainer } from '@testcontainers/postgresql';
import { exec } from 'child_process';
import { config as dotEnvConfig } from 'dotenv';
import * as path from 'path';
import type { StartedNetwork, StartedTestContainer } from 'testcontainers';
import { GenericContainer, Network } from 'testcontainers';
import { promisify } from 'util';
dotEnvConfig();

export type Containers = {
Expand Down Expand Up @@ -49,17 +51,22 @@ export async function startContainers(forkingEnabled: boolean) {
}

async function startL1ChainContainer(network: StartedNetwork) {
const execAsync = promisify(exec);

const IMAGE_NAME = 'fueldev/l1chain:latest';

// since the docker file is doing some copying operations from the host machine so first building the image
const projectRoot = path.resolve(__dirname, '../../../');
const dockerfilePath = path.join(projectRoot, 'docker/l1-chain');
const dockerfilePath = path.join(projectRoot, 'docker/l1-chain/Dockerfile');

const buildCommand = `docker build \
-t ${IMAGE_NAME} \
-f ${dockerfilePath} \
${projectRoot}`;

const buildInstance = await GenericContainer.fromDockerfile(
dockerfilePath
).build(IMAGE_NAME);
await execAsync(buildCommand);

const container: StartedTestContainer = await buildInstance
const container = await new GenericContainer(IMAGE_NAME)
.withExposedPorts(
{ host: 8545, container: 9545 },
{ host: 8080, container: 8081 }
Expand Down Expand Up @@ -135,8 +142,13 @@ async function startBlockCommitterContainer(
l1Container: StartedTestContainer,
fuelNodeContainer: StartedTestContainer
) {
const execAsync = promisify(exec);

const projectRoot = path.resolve(__dirname, '../../../');
const dockerfilePath = path.join(projectRoot, 'docker/block-committer');
const dockerfilePath = path.join(
projectRoot,
'docker/block-committer/Dockerfile'
);

if (postgresContainer && l1Container && fuelNodeContainer) {
const l1ChainIp = l1Container.getIpAddress(network.getName());
Expand All @@ -145,16 +157,18 @@ async function startBlockCommitterContainer(
const db = postgresContainer.getIpAddress(network.getName());

const IMAGE_NAME = 'block-committer';
const buildCommand = `docker build \
-t ${IMAGE_NAME} \
-f ${dockerfilePath} \
${projectRoot}`;

const buildInstance = await GenericContainer.fromDockerfile(
dockerfilePath
).build(IMAGE_NAME);
await execAsync(buildCommand);

const deployerAddresses = await fetch(
`http://${l1Container.getHost()}:8080/deployments.local.json`
).then((resp) => resp.json());

const container: StartedTestContainer = await buildInstance
const container = await new GenericContainer(IMAGE_NAME)
.withName('block-committer')
.withNetwork(network)
.withEnvironment({
Expand Down

0 comments on commit 981b7db

Please sign in to comment.