add buildx for arm #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create a Docker image and deploy to Kubernetes | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.18.2' | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build the project | |
env: | |
VITE_CESIUM_TOKEN: ${{ secrets.VITE_CESIUM_TOKEN }} | |
VITE_N2YO_API_KEY: ${{ secrets.VITE_N2YO_API_KEY }} | |
run: pnpm run build | |
- name: Set up Docker Buildx | |
run: | | |
docker run --privileged --rm tonistiigi/binfmt --install all | |
docker buildx create --use | |
docker buildx inspect --bootstrap | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: Build and push Docker image | |
env: | |
VITE_CESIUM_TOKEN: ${{ secrets.VITE_CESIUM_TOKEN }} | |
VITE_N2YO_API_KEY: ${{ secrets.VITE_N2YO_API_KEY }} | |
run: | | |
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \ | |
-t soylumu/orbital-satellite-tracker:latest \ | |
--build-arg VITE_CESIUM_TOKEN=${{ secrets.VITE_CESIUM_TOKEN }} \ | |
--build-arg VITE_N2YO_API_KEY=${{ secrets.VITE_N2YO_API_KEY }} \ | |
--push . | |
- name: Set up kubectl | |
run: | | |
mkdir -p ~/.kube | |
echo "${{ secrets.KUBE_CONFIG }}" > ~/.kube/config | |
- name: Deploy to Kubernetes | |
run: | | |
kubectl apply -f manifests/deployment.yaml | |
kubectl apply -f manifests/service.yaml | |
kubectl apply -f manifests/ingress.yaml |