Conversation
Adds Dockerfile and docker-compose.yml for containerizing the application. This allows for easier deployment and environment consistency. Also adds .dockerignore to exclude unnecessary files during image building.
Introduces a frontend application built with React and Vite to the Docker Compose setup. This change adds a new Dockerfile with multi-stage builds for frontend development and production, optimized for performance and deployment. It also updates the docker-compose.yml file to include the frontend service, which depends on the backend service.
Database added to compose.yml and mapbox access token is now secret with postgres user and password
Action versions are updated Caching strategy is added
Adds base Kubernetes manifests for the backend and frontend applications. This includes deployment and service definitions, as well as kustomization files for base, development, and staging environments. The deployments use secrets for sensitive configuration data and define image names that can be overridden in the overlays.
Implements CD workflows for the dev and staging environments. This change automates the deployment process to Kubernetes clusters upon pushing to the `dev` and `main` branches respectively. It configures Kustomize, sets up kubeconfig, creates secrets, and deploys the application with appropriate image tags. It also splits the CI workflow to build and push frontend and backend Docker images separately, specifying target runtime environments in Dockerfile.
There was a problem hiding this comment.
Pull Request Overview
This PR sets up Docker containerization and Kubernetes deployments with CI/CD pipelines for the Navio application. It also moves the Mapbox access token from hardcoded values to environment variables for security.
- Adds Docker containerization for both frontend and backend services
- Creates Kubernetes manifests with dev and staging overlay environments
- Implements CI/CD pipelines for automated builds and deployments
- Removes hardcoded Mapbox API key and uses environment variables
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| kubernetes/overlays/staging/namespace.yaml | Defines staging namespace for Kubernetes deployment |
| kubernetes/overlays/staging/kustomization.yaml | Kustomize configuration for staging environment |
| kubernetes/overlays/dev/namespace.yaml | Defines dev namespace for Kubernetes deployment |
| kubernetes/overlays/dev/kustomization.yaml | Kustomize configuration for dev environment |
| kubernetes/base/kustomization.yaml | Base Kustomize configuration |
| kubernetes/base/deployment.yaml | Kubernetes deployment and service definitions |
| frontend/src/components/WorldMap.tsx | Removes hardcoded Mapbox API key |
| frontend/package.json | Adds serve dependency for production deployment |
| docker-compose.yml | Docker Compose setup for local development |
| Dockerfile | Multi-stage Docker build for frontend and backend |
| .github/workflows/ci.yml | Enhanced CI pipeline with Docker image builds |
| .github/workflows/cd.yml | CD pipeline for dev and staging deployments |
| .env.example | Environment variable template |
| .dockerignore | Docker build exclusions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.github/workflows/ci.yml
Outdated
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-node-${{ hashFiles('/package-lock.json') }} |
There was a problem hiding this comment.
The cache key path is incorrect. It should be '**/package-lock.json' to match the package-lock.json files in the repository structure, not /package-lock.json which looks for the file at the root.
| key: ${{ runner.os }}-node-${{ hashFiles('/package-lock.json') }} | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
.github/workflows/ci.yml
Outdated
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.nuget/packages | ||
| key: ${{ runner.os }}-nuget-${{ hashFiles('/*.csproj') }} |
There was a problem hiding this comment.
The cache key path is incorrect. It should be '**/*.csproj' to match all .csproj files in the repository structure, not '/*.csproj' which only looks in the root directory.
| key: ${{ runner.os }}-nuget-${{ hashFiles('/*.csproj') }} | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} |
| bases: | ||
| - ../../base | ||
| namespace: navio-staging | ||
| resources: |
There was a problem hiding this comment.
The bases field is deprecated in Kustomize. Use resources instead to reference the base configuration.
| bases: | |
| - ../../base | |
| namespace: navio-staging | |
| resources: | |
| namespace: navio-staging | |
| resources: | |
| - ../../base |
| bases: | ||
| - ../../base | ||
| namespace: navio-dev | ||
| resources: |
There was a problem hiding this comment.
The bases field is deprecated in Kustomize. Use resources instead to reference the base configuration.
| bases: | |
| - ../../base | |
| namespace: navio-dev | |
| resources: | |
| namespace: navio-dev | |
| resources: | |
| - ../../base |
Updates cache keys in CI workflow to include subdirectories. Corrects kustomization files by relocating the base resource inclusion, ensuring resources from the base are correctly included.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| - name: navio-backend-image | ||
| - name: navio-frontend-image |
There was a problem hiding this comment.
The images configuration is incomplete. Each image entry needs a 'newTag' field to specify the image tag that Kustomize should use when deploying.
| - name: navio-backend-image | |
| - name: navio-frontend-image | |
| - name: navio-backend-image | |
| newTag: latest | |
| - name: navio-frontend-image | |
| newTag: latest |
| - name: navio-backend-image | ||
| - name: navio-frontend-image |
There was a problem hiding this comment.
The images configuration is incomplete. Each image entry needs a 'newTag' field to specify the image tag that Kustomize should use when deploying.
| - name: navio-backend-image | |
| - name: navio-frontend-image | |
| - name: navio-backend-image | |
| newTag: latest | |
| - name: navio-frontend-image | |
| newTag: latest |
.github/workflows/ci.yml
Outdated
| file: ./Dockerfile | ||
| target: backend-runtime | ||
| push: true | ||
| tags: ghcr.io/emirefe/navio-backend:${{ github.ref_name }}-${{ github.sha }} |
There was a problem hiding this comment.
Inconsistent repository owner reference. Line 121 uses 'emirefe' directly while line 132 uses '${{ github.repository_owner }}'. Use the variable for consistency.
| tags: ghcr.io/emirefe/navio-backend:${{ github.ref_name }}-${{ github.sha }} | |
| tags: ghcr.io/${{ github.repository_owner }}/navio-backend:${{ github.ref_name }}-${{ github.sha }} |
.github/workflows/cd.yml
Outdated
|
|
||
| - name: Deploy to Kubernetes | ||
| run: | | ||
| BACKEND_IMAGE_TAG="ghcr.io/${{ github.repository_owner }}/navio-backend:${{ github.ref_name }}-${{ github.sha }}" |
There was a problem hiding this comment.
The image tag construction doesn't match the CI workflow. The CI workflow pushes 'ghcr.io/emirefe/navio-backend' but this deployment expects 'ghcr.io/${{ github.repository_owner }}/navio-backend', creating a mismatch that will cause deployment failures.
Extends CI/CD pipeline to include 'fix' branches, enabling automated builds, docker image creation, and deployment to the development environment. Moves deployment steps from a separate workflow into the main CI/CD workflow to streamline the process and ensure consistency.
Configures a development environment overlay for Kubernetes. This includes setting up namespaces, image tags, and image pull policies. It also adds .exe files to the .gitignore.
Specifies the parent directory as the location for environment variables. This ensures that environment variables are loaded from the correct location relative to the frontend application.
Updates the frontend deployment to inject the Mapbox access key from a Kubernetes secret, and removes the envDir config from the frontend vite config. Updates the frontend image tag in the development overlay.
Refactors the frontend deployment to use Nginx as a reverse proxy. This simplifies the Dockerfile and improves performance by serving static assets directly and proxying API requests to the backend. Removes the dedicated frontend-runtime stage.
Updates the docker-compose file to use a dedicated frontend service based on nginx, rather than a single monolithic nginx service. The frontend service is configured to expose port 80 and to receive the Mapbox access key as an environment variable. The Dockerfile is updated to include a separate frontend-nginx stage and to copy the built frontend application into the nginx webserver. The nginx configuration is set to serve static content.
Moves to a single deployment file for easier management. Removes Kustomize base and overlays in favor of a simpler structure. Updates Nginx configuration to reflect backend service name change. Adds environment variables to the deployment using a configMap.
No description provided.