Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Oct 5, 2023
1 parent 9edab9c commit 87f8b42
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/test-on-kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,16 @@ jobs:
uses: actions/checkout@v3

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: basegun-testing
config: ./infra/kube/kind/kind-config.yml
wait: 60s
verbosity: 2

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.2

- name: Set up ingress controller
run: |
kind create cluster --config ./infra/kube/kind/kind-config.yml
helm repo add traefik https://traefik.github.io/charts && helm repo update
helm install --namespace ingress-traefik --create-namespace traefik traefik/traefik --values ./infra/kube/kind/traefik-values.yml
helm upgrade \
--install \
--wait \
--namespace traefik \
--create-namespace \
--values ./infra/kube/kind/traefik-values.yml \
traefik traefik/traefik
- name: Add hosts to /etc/hosts
run: |
Expand All @@ -48,19 +42,18 @@ jobs:
- name: Build and install basegun with helm, and test if deployment is successful
id: tests
run: |
TAG=$(make get-current-tag) BUILD_TARGET=test docker-compose -f docker-compose-prod.yml build
TAG=$(make get-current-tag) BUILD_TARGET=prod docker-compose -f docker-compose-prod.yml build
kind load docker-image \
basegun-backend:$(make get-current-tag)-prod \
basegun-frontend:$(make get-current-tag)-prod \
--name basegun-testing
basegun-backend:$(make get-current-tag) \
basegun-frontend:$(make get-current-tag)
helm upgrade --install basegun ./infra/kube/helm/ \
--set ingress.hosts[0].host="$LOCAL_DOMAIN" \
--set ingress.hosts[0].paths[0].path="/" \
--set ingress.hosts[0].paths[0].pathType="Prefix" \
--set backend.image.repository="basegun-backend" \
--set backend.image.tag="$(make get-current-tag)-prod" \
--set backend.image.tag="$(make get-current-tag)" \
--set frontend.image.repository="basegun-frontend" \
--set frontend.image.tag="$(make get-current-tag)-prod" \
--set frontend.image.tag="$(make get-current-tag)" \
--set backend.secret.create="true" \
--set-string backend.secret.values.AWS_ACCESS_KEY_ID="${{ secrets.AWS_ACCESS_KEY_ID }}" \
--set-string backend.secret.values.AWS_SECRET_ACCESS_KEY="${{ secrets.AWS_SECRET_ACCESS_KEY }}" \
Expand Down
1 change: 1 addition & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ COPY tests/ tests/
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"]

FROM base as prod
COPY tests/ tests/
RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu \
torch==1.13.0+cpu torchvision==0.14.0+cpu && rm -r /root/.cache
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"]
4 changes: 2 additions & 2 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- WORKSPACE=${WORKSPACE:-prod}
image: basegun-backend:${TAG}-prod
image: basegun-backend:${TAG}
ports:
- 5000:5000

Expand All @@ -23,6 +23,6 @@ services:
context: ./frontend
target: prod
container_name: basegun-frontend
image: basegun-frontend:${TAG}-prod
image: basegun-frontend:${TAG}
ports:
- ${PORT_PROD:-80}:8080

0 comments on commit 87f8b42

Please sign in to comment.