Skip to content

Commit

Permalink
Merge pull request #222 from okto-hq/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
nishithdcx authored Jan 22, 2025
2 parents d2659fb + b445c07 commit 1fee8b1
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 19 deletions.
68 changes: 49 additions & 19 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,65 @@
name: GitHub Pages deploy
name: Continuous Deployment

on:
push:
branches:
- release
- temp-nish
- main
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
app_build:
runs-on: ci-arm-runner
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Use Node.js 20.x
uses: actions/setup-node@v1

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build & push Docker image
uses: docker/build-push-action@v4
with:
node-version: "20.x"
builder: ${{ steps.buildx.outputs.name }}
context: "."
file: "deployment/Dockerfile"
push: true
tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.run_id }}"
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true
app_deploy:
runs-on: ubuntu-latest
needs: app_build
env:
BRANCH: ${{ (github.ref_name == 'release') && 'infra' || 'infra-staging' }}
IMAGE_TAG: ${{ github.run_id }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH }}

- name: Installing my packages
run: yarn install
- uses: fregante/setup-git-user@v2

- name: Build my App
- name: Helm App Version Update
run: |
yarn run export
touch out/.nojekyll
- name: Create CNAME
run: echo 'docs.okto.tech' > out/CNAME
found_ver=$(yq -e '.version' ./k8s/values.yaml);
echo "Updating app version to $IMAGE_TAG from $found_ver";
yq -ie ".version=\"$IMAGE_TAG\"" ./k8s/values.yaml
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: out
- name: Helm App Version commit & push
run: |
git commit -am "Updating app version to $IMAGE_TAG"
git push
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Okto Docs



## Overview

This repo houses Okto's [documentation](https://docs.okto.tech). More info below on how to run the website or submit PRs for new documentation, or website pages.
Expand Down
39 changes: 39 additions & 0 deletions deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM node:20-alpine3.17 AS build

# OS Packages
RUN apk add --update --no-cache dumb-init

WORKDIR /app
COPY package.json ./

COPY source.config.ts ./
RUN npm install

COPY . .

RUN npm run build

FROM node:20-alpine3.17 AS app

LABEL MAINTAINER Nishith Kulshrestha <nishith.kulshrestha@coindcx.com>

COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init

# Non-Root user
RUN addgroup -g 7777 dcx &&\
adduser -D -h /home/dcx dcx -s /bin/false -u 7777 -G dcx

USER dcx
RUN mkdir /home/dcx/app
WORKDIR /home/dcx/app

# setup project structure
COPY --chown=dcx:dcx --from=build /app/.next ./.next
COPY --chown=dcx:dcx . .
COPY --chown=dcx:dcx --from=build /app/package-lock.json ./package-lock.json

# only install production dependencies
RUN npm ci --only=production

ENTRYPOINT [ "/usr/bin/dumb-init", "--" ]
CMD [ "./deployment/entrypoint.sh" ]
5 changes: 5 additions & 0 deletions deployment/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e

# start application
npm run start

0 comments on commit 1fee8b1

Please sign in to comment.