Skip to content

Commit

Permalink
Added another Docker files as an example. These files are proposed in…
Browse files Browse the repository at this point in the history
… PR #20. They include the generation of a PostgreSQL and Kong instance.

They are included as an example and not as "official" King's docker support because I consider that King`s docker should only include the King UI deploy.
  • Loading branch information
ligreman committed Jul 29, 2023
1 parent f36ada1 commit af9d6c2
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/docker_king_with_kong/.dockerignore
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions examples/docker_king_with_kong/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions examples/docker_king_with_kong/README.md
Original file line number Diff line number Diff line change
@@ -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
50 changes: 50 additions & 0 deletions examples/docker_king_with_kong/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit af9d6c2

Please sign in to comment.