From b28b02eb8928181f1623fc8aba9dd72796652379 Mon Sep 17 00:00:00 2001 From: grandwizard28 Date: Tue, 12 Jul 2022 16:59:36 +0530 Subject: [PATCH 1/3] build(docker): Change order of instructions to use docker cache --- Dockerfile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index afd210b12..940161955 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,22 @@ FROM node:12.16-alpine -COPY . /app - WORKDIR /app RUN apk upgrade --update \ && apk add bash git ca-certificates \ && npm install -g bower \ - && npm --unsafe-perm --production install \ && apk del git \ && rm -rf /var/cache/apk/* \ /app/.git \ /app/screenshots \ - /app/test \ - && adduser -H -S -g "Konga service owner" -D -u 1200 -s /sbin/nologin konga \ - && mkdir /app/kongadata /app/.tmp \ - && chown -R 1200:1200 /app/views /app/kongadata /app/.tmp + /app/test -EXPOSE 1337 +COPY package.json package-lock.json ./ + +RUN npm install -VOLUME /app/kongadata +COPY . . + +EXPOSE 1337 ENTRYPOINT ["/app/start.sh"] From a3f72a511b56dac2911bd6387bd238eaf7ac51d4 Mon Sep 17 00:00:00 2001 From: grandwizard28 Date: Tue, 12 Jul 2022 17:00:12 +0530 Subject: [PATCH 2/3] ci(git): Add postgresdata to gitignore and dockerignore --- .dockerignore | 3 +++ .gitignore | 1 + 2 files changed, 4 insertions(+) diff --git a/.dockerignore b/.dockerignore index 3c5419e83..51981a42a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -121,3 +121,6 @@ nbproject /config/mssqlconfig.js /www/ /seeds/ +# +kongadata/ +postgresdata/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4f49bdffa..3a747f896 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,4 @@ nbproject .env /seeds/ /seeds/ +/postgresdata/ From 9c535c40e6723f6bc84a11c4a32df314a625d68e Mon Sep 17 00:00:00 2001 From: grandwizard28 Date: Tue, 12 Jul 2022 17:01:03 +0530 Subject: [PATCH 3/3] build(docker): Change compose file to spin up konga and not kong --- docker-compose.yml | 93 +++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 59 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 62175e8b4..6cbc3ead4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,69 +1,44 @@ -version: "3" - -networks: - kong-net: - driver: bridge +version: "3.8" services: - - ####################################### - # Postgres: The database used by Kong - ####################################### - kong-database: - image: postgres:9.6 + konga: + image: konga:latest + build: . restart: always - networks: - - kong-net - environment: - POSTGRES_USER: kong - POSTGRES_DB: kong - POSTGRES_PASSWORD: kong + container_name: konga ports: - - "5432:5432" - healthcheck: - test: ["CMD", "pg_isready", "-U", "kong"] - interval: 5s - timeout: 5s - retries: 5 - - ####################################### - # Kong database migration - ####################################### - kong-migration: - image: kong:1.5 - command: "kong migrations bootstrap" - networks: - - kong-net - restart: on-failure + - 1337:1337 environment: - KONG_PG_HOST: kong-database - KONG_PG_PASSWORD: kong - links: - - kong-database + - NODE_ENV=development + - DB_ADAPTER=postgres + - DB_HOST=konga-database + - DB_PORT=5432 + - DB_USER=konga + - DB_PASSWORD=password + - DB_DATABASE=konga + volumes: + - ./api/:/app/api/ + logging: + driver: "json-file" + options: + max-size: 10m + max-file: "3" depends_on: - - kong-database - - ####################################### - # Kong: The API Gateway - ####################################### - kong: - image: kong:1.5 + - konga-database + entrypoint: ["npm", "start"] + konga-database: + image: postgres:9.6 restart: always - networks: - - kong-net environment: - KONG_PG_HOST: kong-database - KONG_PG_PASSWORD: kong - KONG_PROXY_LISTEN: 0.0.0.0:8000 - KONG_PROXY_LISTEN_SSL: 0.0.0.0:8443 - KONG_ADMIN_LISTEN: 0.0.0.0:8001 - depends_on: - - kong-database + POSTGRES_USER: konga + POSTGRES_PASSWORD: password + POSTGRES_DB: konga + volumes: + - ./postgresdata:/var/lib/postgresql/data + ports: + - 5433:5432 healthcheck: - test: ["CMD", "curl", "-f", "http://kong:8001"] + test: ["CMD", "pg_isready", "-U", "konga"] interval: 5s - timeout: 2s - retries: 15 - ports: - - 8001:8001 - - 8000:8000 \ No newline at end of file + timeout: 5s + retries: 5 \ No newline at end of file