Add pg_dump to single dockerfile

This commit is contained in:
Adria Navarro 2023-06-22 11:29:32 +01:00
parent a5ae0e5a3f
commit 55e38725db
3 changed files with 11 additions and 6 deletions

View File

@ -37,6 +37,14 @@ COPY --from=build /worker /worker
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common nginx uuid-runtime redis-server 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 # install other dependencies, nodejs, oracle requirements, jdk8, redis, nginx
WORKDIR /nodejs WORKDIR /nodejs
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && \ RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && \

View File

@ -26,7 +26,7 @@ RUN apt-get install unzip libaio1
COPY scripts/integrations/oracle/ scripts/integrations/oracle/ COPY scripts/integrations/oracle/ scripts/integrations/oracle/
RUN /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh 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 \ RUN apt update && apt upgrade -y \
&& apt install software-properties-common apt-transport-https curl gpg -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 \ && curl -fsSl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null \

View File

@ -1,4 +1,4 @@
import { GenericContainer, StartedTestContainer } from "testcontainers" import { GenericContainer } from "testcontainers"
import postgres from "../../../../packages/server/src/integrations/postgres" import postgres from "../../../../packages/server/src/integrations/postgres"
jest.unmock("pg") jest.unmock("pg")
@ -6,10 +6,9 @@ jest.unmock("pg")
describe("getExternalSchema", () => { describe("getExternalSchema", () => {
describe("postgres", () => { describe("postgres", () => {
let config: any let config: any
let container: StartedTestContainer
beforeAll(async () => { beforeAll(async () => {
container = await new GenericContainer("postgres") const container = await new GenericContainer("postgres")
.withExposedPorts(5432) .withExposedPorts(5432)
.withEnv("POSTGRES_PASSWORD", "password") .withEnv("POSTGRES_PASSWORD", "password")
.start() .start()
@ -29,8 +28,6 @@ describe("getExternalSchema", () => {
} }
}) })
afterAll(() => container.stop())
it("can export an empty database", async () => { it("can export an empty database", async () => {
const integration = new postgres.integration(config) const integration = new postgres.integration(config)
const result = await integration.getExternalSchema() const result = await integration.getExternalSchema()