mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-28 14:20:23 +00:00
66 lines
2.4 KiB
YAML
66 lines
2.4 KiB
YAML
name: Build Docker image and create k8s with it
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: pokeapi/pokeapi
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Build
|
|
id: docker_build
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Resources/docker/app/Dockerfile
|
|
push: false
|
|
load: true
|
|
platforms: local
|
|
tags: pokeapi/pokeapi:local
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
- name: Lint k8s
|
|
run: (cd Resources/k8s/kustomize && yamllint .)
|
|
- name: Create k8s Kind Cluster
|
|
uses: helm/kind-action@v1.1.0
|
|
with:
|
|
version: v0.11.1
|
|
- name: Create deployment configuration
|
|
run: |
|
|
cp Resources/k8s/kustomize/base/secrets/postgres.env.sample Resources/k8s/kustomize/base/secrets/postgres.env
|
|
cp Resources/k8s/kustomize/base/secrets/graphql.env.sample Resources/k8s/kustomize/base/secrets/graphql.env
|
|
cp Resources/k8s/kustomize/base/config/pokeapi.env.sample Resources/k8s/kustomize/base/config/pokeapi.env
|
|
- name: K8s Apply
|
|
run: |
|
|
make kustomize-local-apply
|
|
kubectl proxy &
|
|
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/
|
|
- name: Set default namespace and print info
|
|
run: |
|
|
kubectl config set-context --current --namespace pokeapi
|
|
kubectl describe deployment
|
|
- name: Migrate and build data
|
|
run: |
|
|
make k8s-migrate
|
|
make k8s-build-db
|
|
bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/pal-park-area/5/
|
|
- name: K8s wait for job
|
|
run: |
|
|
kubectl wait --timeout=120s --for=condition=complete job/load-graphql
|
|
last_command=$(kubectl get job -o jsonpath='{.status.succeeded}' load-graphql)
|
|
test "$last_command" -eq 1
|