Skip to content

Commit f62942a

Browse files
committed
Much better and actually working solution for BigQuery on M Macs
1 parent a2d028d commit f62942a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

packages/modules/gcloud/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM gcr.io/google.com/cloudsdktool/google-cloud-cli:529.0.0-emulators
22
FROM fsouza/fake-gcs-server:1.52.2
3-
FROM --platform=linux/amd64 ghcr.io/goccy/bigquery-emulator:0.6.6
3+
FROM ghcr.io/goccy/bigquery-emulator:0.6.6
44
FROM gcr.io/cloud-spanner-emulator/emulator:1.5.37

packages/modules/gcloud/src/bigquery-emulator-container.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export class BigQueryEmulatorContainer extends GenericContainer {
88
constructor(image: string) {
99
super(image);
1010
this.withExposedPorts(EMULATOR_PORT).withWaitStrategy(Wait.forListeningPorts()).withStartupTimeout(120_000);
11+
12+
// The BigQuery emulator image is not multi platform
13+
// so this fix is needed for M Macs
14+
if (process.arch === "arm64") {
15+
this.withPlatform("linux/amd64");
16+
}
1117
}
1218

1319
public withProjectId(projectId: string): BigQueryEmulatorContainer {

packages/testcontainers/src/utils/test-helper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ export const getImage = (dirname: string, index = 0): string => {
1414
return fs
1515
.readFileSync(path.resolve(dirname, "..", "Dockerfile"), "utf-8")
1616
.split("\n")
17-
[index].replace(/^from /i, "")
18-
.trim();
17+
[index].split(" ")[1];
1918
};
2019

2120
export const checkContainerIsHealthy = async (container: StartedTestContainer): Promise<void> => {

0 commit comments

Comments
 (0)