-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from okto-hq/release
Release
- Loading branch information
Showing
4 changed files
with
94 additions
and
19 deletions.
There are no files selected for viewing
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
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 |
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
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
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" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# start application | ||
npm run start |