diff --git a/.github/workflows/kubeconfig.yml b/.github/workflows/kubeconfig.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/new_deploy.yml b/.github/workflows/new_deploy.yml new file mode 100644 index 0000000..ccd7493 --- /dev/null +++ b/.github/workflows/new_deploy.yml @@ -0,0 +1,37 @@ +name: Deploy + +on: + push: + branches: [master] + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + # Check out the repository + - name: Check out code + uses: actions/checkout@v3 + + # Set up Docker + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + + # Log in to DigitalOcean Container Registry + - name: Log in to DigitalOcean + run: echo "${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}" | docker login -u "doctl" --password-stdin registry.digitalocean.com + + # Build and push Docker image + - name: Build and push Docker image + run: | + docker buildx build --platform linux/amd64,linux/arm64 \ + --tag registry.digitalocean.com/dailybruin/dbonline:latest \ + --push . + # Update Kubernetes deployment + - name: Update Kubernetes deployment + env: + KUBECONFIG: ${{ secrets.KUBECONFIG }} + run: | + kubectl set image deployment/ =registry.digitalocean.com/dailybruin/dbonline:latest + kubectl rollout status deployment/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..344d890 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:16.20.2 + +RUN apt-get update && apt-get install -y \ + yarn + +WORKDIR /usr/src/flamingo + +COPY .next ./.next + +COPY node_modules ./node_modules + +COPY package.json . + +COPY yarn.lock . + +EXPOSE 1919 + +CMD ["yarn", "deploy"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..90ae0c1 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +yarn build +docker build --platform="linux/amd64" -t registry.digitalocean.com/dailybruin/flamingotestedamd64:latest . +docker push registry.digitalocean.com/dailybruin/flamingotestedamd64:latest \ No newline at end of file diff --git a/next.config.js b/next.config.js index cdb124f..919293c 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,3 @@ const withImages = require("next-images"); -module.exports = withImages(); +module.exports = withImages(); \ No newline at end of file diff --git a/pages/api/healthy.jsx b/pages/api/healthy.jsx new file mode 100644 index 0000000..ae9fb68 --- /dev/null +++ b/pages/api/healthy.jsx @@ -0,0 +1,3 @@ +export default function handler(req, res) { + res.status(200).json({ "status": "ok" }) +} \ No newline at end of file diff --git a/pages/api/hostname.jsx b/pages/api/hostname.jsx new file mode 100644 index 0000000..edd5301 --- /dev/null +++ b/pages/api/hostname.jsx @@ -0,0 +1,6 @@ +var os = require("os"); +var hostname = os.hostname(); + +export default function handler(req, res) { + res.status(200).json({ "hostname": hostname }) +} \ No newline at end of file