diff --git a/examples/docker_king_with_kong/.dockerignore b/examples/docker_king_with_kong/.dockerignore new file mode 100644 index 0000000..71e7bbc --- /dev/null +++ b/examples/docker_king_with_kong/.dockerignore @@ -0,0 +1,18 @@ +# ignore .git and .cache folders +.git +.cache + +# ignore all markdown files (md) beside all README*.md other than +# README-secret.md +*.md + +# ignore docs folders +docs/ + +# ignore Dockerfile and docker-compose files +*Dockerfile* +*docker-compose* + +# ignore node modules and logs +node_modules/ +npm-debug.log diff --git a/examples/docker_king_with_kong/Dockerfile b/examples/docker_king_with_kong/Dockerfile new file mode 100644 index 0000000..afa2baa --- /dev/null +++ b/examples/docker_king_with_kong/Dockerfile @@ -0,0 +1,17 @@ +# King Build Image +FROM node:19-alpine as dist + +WORKDIR /src + +COPY package*.json . + +RUN npm install + +COPY . . + +RUN npm run build-prod + +# King Nginx image +FROM nginx:1.23.2-alpine as nginx + +COPY --from=dist /src/dist/king /usr/share/nginx/html diff --git a/examples/docker_king_with_kong/README.md b/examples/docker_king_with_kong/README.md new file mode 100644 index 0000000..b7e8caf --- /dev/null +++ b/examples/docker_king_with_kong/README.md @@ -0,0 +1,9 @@ +### Docker + +You can try King for Kong using [docker](https://docs.docker.com/get-docker/) and [docker-compose](https://docs.docker.com/compose/install/) with the next command. + +``` +docker-compose up -d +``` + +This will create a Kong Api Gateway container, a Postgresql container and finally a King for king container. After that King for Kong will be available at `http://localhost:8080` in production mode diff --git a/examples/docker_king_with_kong/docker-compose.yaml b/examples/docker_king_with_kong/docker-compose.yaml new file mode 100644 index 0000000..2b92995 --- /dev/null +++ b/examples/docker_king_with_kong/docker-compose.yaml @@ -0,0 +1,50 @@ +version: '3' + +services: + kong-database: + image: postgres:15.1-alpine + container_name: kong-database + environment: + - POSTGRES_USER=kong + - POSTGRES_DB=kong + - POSTGRES_PASSWORD=kong + volumes: + - "db-data-kong-postgres:/var/lib/postgresql/data" + kong-migrations: + image: kong:3.0.1-alpine + environment: + - KONG_DATABASE=postgres + - KONG_PG_HOST=kong-database + - KONG_PG_PASSWORD=kong + command: kong migrations bootstrap + restart: on-failure + kong: + image: kong:3.0.1-alpine + container_name: kong + environment: + - KONG_PG_HOST=kong-database + - KONG_PG_USER=kong + - KONG_PG_PASSWORD=kong + - KONG_PROXY_ACCESS_LOG=/dev/stdout + - KONG_ADMIN_ACCESS_LOG=/dev/stdout + - KONG_PROXY_ERROR_LOG=/dev/stderr + - KONG_ADMIN_ERROR_LOG=/dev/stderr + - 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 + - KONG_CUSTOM_PLUGINS=kong-plugin-moesif + restart: on-failure + ports: + - 8000:8000 + - 8443:8443 + - 8001:8001 + king: + build: + context: . + container_name: king + restart: on-failure + ports: + - 8080:80 + +volumes: + db-data-kong-postgres: