Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New git hub action #160

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
37 changes: 37 additions & 0 deletions .github/workflows/new_deploy.yml
Original file line number Diff line number Diff line change
@@ -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/<flamingo> <container-name>=registry.digitalocean.com/dailybruin/dbonline:latest
kubectl rollout status deployment/<flamingo>
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const withImages = require("next-images");

module.exports = withImages();
module.exports = withImages();
3 changes: 3 additions & 0 deletions pages/api/healthy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function handler(req, res) {
res.status(200).json({ "status": "ok" })
}
6 changes: 6 additions & 0 deletions pages/api/hostname.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var os = require("os");
var hostname = os.hostname();

export default function handler(req, res) {
res.status(200).json({ "hostname": hostname })
}