From 55e38725db9db1f7eaa78236b7a94a86c477ccb2 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 22 Jun 2023 11:29:32 +0100 Subject: [PATCH] Add pg_dump to single dockerfile --- hosting/single/Dockerfile | 8 ++++++++ packages/server/Dockerfile | 2 +- .../external-schema/postgres.integration.spec.ts | 7 ++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/hosting/single/Dockerfile b/hosting/single/Dockerfile index 3ffba17cef..fe6caa0ed7 100644 --- a/hosting/single/Dockerfile +++ b/hosting/single/Dockerfile @@ -37,6 +37,14 @@ COPY --from=build /worker /worker RUN apt-get update && \ apt-get install -y --no-install-recommends software-properties-common nginx uuid-runtime redis-server +# Install postgres client for pg_dump utils +RUN apt install software-properties-common apt-transport-https gpg -y \ + && curl -fsSl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null \ + && echo deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main | tee /etc/apt/sources.list.d/postgresql.list \ + && apt update -y \ + && apt install postgresql-client-15 -y \ + && apt remove software-properties-common apt-transport-https gpg -y + # install other dependencies, nodejs, oracle requirements, jdk8, redis, nginx WORKDIR /nodejs RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && \ diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index a125974e62..07cc10bf9d 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get install unzip libaio1 COPY scripts/integrations/oracle/ scripts/integrations/oracle/ RUN /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh -# Add the PostgreSQL repository +# Install postgres client for pg_dump utils RUN apt update && apt upgrade -y \ && apt install software-properties-common apt-transport-https curl gpg -y \ && curl -fsSl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null \ diff --git a/qa-core/src/integrations/external-schema/postgres.integration.spec.ts b/qa-core/src/integrations/external-schema/postgres.integration.spec.ts index 065f922792..e53377e70d 100644 --- a/qa-core/src/integrations/external-schema/postgres.integration.spec.ts +++ b/qa-core/src/integrations/external-schema/postgres.integration.spec.ts @@ -1,4 +1,4 @@ -import { GenericContainer, StartedTestContainer } from "testcontainers" +import { GenericContainer } from "testcontainers" import postgres from "../../../../packages/server/src/integrations/postgres" jest.unmock("pg") @@ -6,10 +6,9 @@ jest.unmock("pg") describe("getExternalSchema", () => { describe("postgres", () => { let config: any - let container: StartedTestContainer beforeAll(async () => { - container = await new GenericContainer("postgres") + const container = await new GenericContainer("postgres") .withExposedPorts(5432) .withEnv("POSTGRES_PASSWORD", "password") .start() @@ -29,8 +28,6 @@ describe("getExternalSchema", () => { } }) - afterAll(() => container.stop()) - it("can export an empty database", async () => { const integration = new postgres.integration(config) const result = await integration.getExternalSchema()