feat(initial commit): first commit, testing out deployment
This commit is contained in:
parent
9b83b69068
commit
1736e9eb09
27 changed files with 7097 additions and 1 deletions
88
.forgejo/workflows/start.yaml
Normal file
88
.forgejo/workflows/start.yaml
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: node:latest
|
||||
steps:
|
||||
- run: |
|
||||
unset HISTFILE
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sh get-docker.sh
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Login to Forgejo Container Registry
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
# NOTE: Used for Forgejo Runner variables
|
||||
registry: ${{ vars.REGISTRY_DOMAIN }}
|
||||
username: ${{ vars.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Build and Push the Application
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ vars.REGISTRY_DOMAIN }}/${{ FORGEJO_REPOSITORY }}:app
|
||||
file: Dockerfile
|
||||
|
||||
- name: Logout and Cleanup
|
||||
run: |
|
||||
docker logout ${{ vars.REGISTRY_DOMAIN }}
|
||||
rm -rf ~/.*history
|
||||
rm -rf ~/.docker/config.json
|
||||
|
||||
|
||||
#- run: |
|
||||
# ls -la
|
||||
# echo "test"
|
||||
|
||||
# Will probably SSH into docker instance
|
||||
#
|
||||
deploy:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: ubuntu:latest
|
||||
steps:
|
||||
- name: Prerequisite, grab essential packages and remotely connect to the server.
|
||||
run: |
|
||||
# Get Prerequisite Packages
|
||||
unset HISTFILE
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sh get-docker.sh
|
||||
|
||||
# Begin setting up SSH w/ Secrets
|
||||
mkdir ~/.ssh
|
||||
install -m 600 -D /dev/null ~/.ssh/${{ secrets.DEPLOY_USER }}
|
||||
echo "${{ secrets.DEPLOY_KEY }}" | base64 -d > ~/.ssh/${{ secrets.DEPLOY_USER }}
|
||||
ssh-keyscan -H -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_HOST }} > ~/.ssh/known_hosts
|
||||
|
||||
printf "Host deploy\nPort ${{ secrets.DEPLOY_PORT }}\nHostname ${{ secrets.DEPLOY_HOST }}\nIdentityFile ~/.ssh/${{ secrets.DEPLOY_USER }}\nUser ${{ secrets.DEPLOY_USER }}" > ~/.ssh/config
|
||||
docker context create deploy --docker "host=ssh://deploy"
|
||||
docker context use deploy
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v6
|
||||
|
||||
|
||||
- name: Write secrets in an .env file
|
||||
run: |
|
||||
echo ${{ secrets.API_PORT }} >> .env
|
||||
|
||||
- name: Use the docker-compose.yml file to refresh the instance
|
||||
run: |
|
||||
# Check to see if we have checked out the repo.
|
||||
docker compose down
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue