# kind: Deployment # apiVersion: apps/v1 # metadata: # namespace: ${NAMESPACE} # name: portfolio-page # labels: # app: portfolio-page # spec: # replicas: 1 # selector: # matchLabels: # app: portfolio-page # template: # metadata: # labels: # app: portfolio-page # spec: # containers: # - name: portfolio-page # image: kimjunte/portfolio_page:$GITHUB_REF_SLUG # imagePullPolicy: Always # ports: # - name: portfolioport # containerPort: 3000 # imagePullSecrets: # - name: registrypullsecret # # This is a file I used to push juntekim.com as deployment while keeping a different namespace for prod and staging # --- # apiVersion: v1 # kind: Service # metadata: # name: portfolio-page # namespace: ${NAMESPACE} # spec: # ports: # - protocol: TCP # name: portfolioport # port: 80 # targetPort: 3000 # selector: # app: portfolio-page # --- # apiVersion: traefik.io/v1alpha1 # kind: IngressRoute # metadata: # name: juntekim-portfolio-page # namespace: ${NAMESPACE} # spec: # entryPoints: # - websecure # routes: # - match: "Host(`${HOSTNAME}`) || Host(`www.${HOSTNAME}`)" # kind: Rule # services: # - name: portfolio-page # port: 80 # passHostHeader: false # tls: # certResolver: myresolver # domains: # - main: ${HOSTNAME} # for the beta version lets use stripe-to-invoice-dev.juntekim.com for now and deploy things on feature and main branch # only once it goes to production from a release branch we'll make this go to the same name space as production database which default as well - however the postgres data # will be postgres-prod, with different password and user name # the workflow for the deployment the portfolio page looks as follows including pushing to the docker registry # # name: Build juntekim.com # on: # push: # tags: # - "*" # branches: # - "**" # jobs: # Push-to-docker-hub: # runs-on: ubuntu-22.04 # steps: # - uses: actions/checkout@v3 # - name: Inject slug/short variables # uses: rlespinasse/github-slug-action@v4 # - name: Login to Docker Hub # uses: docker/login-action@v3 # with: # username: ${{ secrets.DOCKER_HUB_USERNAME }} # password: ${{ secrets.DOCKER_HUB_TOKEN }} # - name: Build Docker Image # run: | # docker build \ # -f juntekim_frontend/deployment/Dockerfile \ # -t docker.io/kimjunte/portfolio_page:$GITHUB_REF_SLUG \ # juntekim_frontend # - name: Push to Docker Hub # run: | # docker push docker.io/kimjunte/portfolio_page:$GITHUB_REF_SLUG # run-on-k8s: # runs-on: mealcraft-runners # <-- your ARC scale set label # needs: Push-to-docker-hub # steps: # - uses: actions/checkout@v4 # # Install kubectl inside containerMode's default Ubuntu # - name: Install kubectl # run: | # sudo apt-get update # sudo apt-get install -y curl ca-certificates # curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" # sudo install -m 0755 kubectl /usr/local/bin/kubectl # - name: Install envsubst # run: | # sudo apt-get update # sudo apt-get install -y gettext # <---- envsubst lives here # # Configure kubeconfig from ARC's service account # - name: Configure kubeconfig # run: | # KUBE_HOST="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT" # SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) # CA_CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt # NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) # kubectl config set-cluster microk8s --server="$KUBE_HOST" --certificate-authority="$CA_CERT" # kubectl config set-credentials runner --token="$SA_TOKEN" # kubectl config set-context runner-context --cluster=microk8s --user=runner --namespace="$NAMESPACE" # kubectl config use-context runner-context # - name: Inject slug variables # uses: rlespinasse/github-slug-action@v4 # - name: Set namespace # id: ns # run: | # if [[ $GITHUB_REF == refs/tags/* ]]; then # echo "NAMESPACE=default" >> $GITHUB_ENV # else # echo "NAMESPACE=staging" >> $GITHUB_ENV # fi # - name: Set hostname # run: | # if [ "$NAMESPACE" = "staging" ]; then # echo "HOSTNAME=staging.juntekim.com" >> $GITHUB_ENV # else # echo "HOSTNAME=juntekim.com" >> $GITHUB_ENV # fi # - name: Deploy to Kubernetes # run: | # export IMAGE="docker.io/kimjunte/portfolio_page:$GITHUB_REF_SLUG" # export NAMESPACE HOSTNAME # envsubst < juntekim_frontend/deployment/deployment.yml | kubectl apply -f - # envsubst < juntekim_frontend/deployment/service.yml | kubectl apply -f - # envsubst < juntekim_frontend/deployment/ingressroute.yml | kubectl apply -f - # 1) First make me a Dockerfile for the nextjs app that i have under stripe_to_invoice that is produciton ready # 2) make me a depoloyment file which i'll have under stripe_to_invoice/deployment/deployment.yaml # 3) Make me the github workflow to run this in feature/* or main ( in dev) and releases in prod ( which just uses a different database)