Skip to content

Commit

Permalink
feat: add deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
shuse2 committed Jan 30, 2024
1 parent 053723d commit 5610d70
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://docs.github.com/en/actions/deployment/deploying-to-your-cloud-provider/deploying-to-amazon-elastic-container-service
name: Deployment

on:
push:
branches:
- main
- 32-add-deployment

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:lts

WORKDIR /app/website

EXPOSE 3000 35729
COPY . .
RUN yarn install
RUN yarn build

CMD ["yarn", "serve"]
5 changes: 3 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// See: https://docusaurus.io/docs/api/docusaurus-config

import { themes as prismThemes } from 'prism-react-renderer';
import * as process from 'process';

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand All @@ -13,10 +14,10 @@ const config = {
favicon: 'img/favicon.png',

// Set the production url of your site here
url: 'https://docs.lisk.com',
url: process.env.LISK_DOC_URL ?? 'https://documentation.lisk.com',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/lisk-documentation/',
baseUrl: process.env.LISK_DOC_BASE_URL ?? '/',

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
Expand Down

0 comments on commit 5610d70

Please sign in to comment.