-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/0xSpaceShard/nimbora-docs …
…into develop
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 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
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,46 @@ | ||
name: build-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- stage | ||
|
||
env: | ||
working-directory: . | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: github.ref_name == ${{ github.ref_name }} | ||
steps: | ||
- name: Deploy the service to "${{ github.ref_name }}" | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets[format('SSH_HOST_{0}', github.ref_name)] }} | ||
username: ${{ secrets[format('SSH_USER_{0}', github.ref_name)] }} | ||
key: ${{ secrets[format('SSH_PRIVATE_KEY_{0}', github.ref_name)] }} | ||
port: ${{ secrets[format('SSH_PORT_{0}', github.ref_name)] }} | ||
script: | | ||
SSH_NESTED_HOST="${{ secrets[format('SSH_NESTED_HOST_{0}', github.ref_name)] }}" | ||
ssh $SSH_NESTED_HOST -T <<EOA | ||
echo "### Deployment started" | ||
if [ -d "${{ secrets.BASE_PATH }}/${{ github.repository }}-${{ github.ref_name }}" ]; then | ||
cd ${{ secrets.BASE_PATH }}/${{ github.repository }}-${{ github.ref_name }} && \ | ||
echo "### Generate ENV file" | ||
> .env | ||
echo BRANCH=${{ github.ref_name }} >> .env | ||
echo PORT=${{ vars[format('PORT_{0}', github.ref_name)] }} >> .env | ||
echo EXCLUDE_FILES=${{ vars[format('EXCLUDE_FILES_{0}', github.ref_name)] }} >> .env | ||
git fetch && \ | ||
git checkout ${{ github.ref_name }} && \ | ||
git reset --hard origin/${{ github.ref_name }} && \ | ||
docker-compose -f docker-compose.yml pull && \ | ||
docker-compose -f docker-compose.yml up -d --build | ||
else | ||
echo "Directory does not exist, aborting script." | ||
exit 1 | ||
fi | ||
EOA |
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,8 @@ | ||
FROM node:alpine3.18 as build | ||
|
||
WORKDIR /app | ||
COPY package.json yarn.lock ./ | ||
|
||
RUN yarn | ||
|
||
COPY . . |
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,17 @@ | ||
version: '3.9' | ||
services: | ||
nimbora-docs: | ||
container_name: nimbora-docs_${BRANCH} | ||
build: | ||
context: . | ||
ports: | ||
- ${PORT}:${PORT} | ||
environment: | ||
- EXCLUDE_FILES=${EXCLUDE_FILES} | ||
command: ['yarn', 'start', '-h', '0.0.0.0', '-p', '${PORT}'] | ||
logging: | ||
driver: 'json-file' | ||
options: | ||
tag: '{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}' | ||
max-size: '50m' | ||
max-file: '100' |