-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dockerized and added deployment workflow
- Loading branch information
Showing
4 changed files
with
57 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: ["devops(dockerfile)/dev"] | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: deployment_lock | ||
cancel-in-progress: false | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up SSH key | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.KEY }}" > ~/.ssh/key | ||
chmod 600 ~/.ssh/key | ||
ssh-keyscan ${{ secrets.HOST }} >> ~/.ssh/known_hosts | ||
- name: Create .env file | ||
run: | | ||
echo 'DATABASE_URL="${{ secrets.DATABASE_URL }}"' >> .env | ||
echo 'NEXTAUTH_URL="${{ secrets.NEXTAUTH_URL }}"' >> .env | ||
echo 'NEXT_PUBLIC_LEPTON_API_URL="${{ secrets.NEXT_PUBLIC_LEPTON_API_URL }}"' >> .env | ||
echo 'ALLOWED_GROUP_SLUGS="${{ secrets.ALLOWED_GROUP_SLUGS }}"' >> .env | ||
echo 'NEXTAUTH_SECRET="${{ secrets.NEXTAUTH_SECRET }}"' >> .env | ||
- name: Copy .env to VPS | ||
run: | | ||
scp -v -i ~/.ssh/key .env ${{ secrets.USER }}@${{ secrets.HOST }}:${{ secrets.PATH }} | ||
- name: Deploy to VPS | ||
run: | | ||
ssh -v -i ~/.ssh/key ${{ secrets.USER }}@${{ secrets.HOST }} << 'ENDSSH' | ||
cd ${{ secrets.PATH }} | ||
chmod 0600 .env | ||
git pull | ||
make prod | ||
ENDSSH |
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,3 +1,12 @@ | ||
.PHONY: db | ||
db: | ||
docker compose up -d | ||
|
||
.PHONY: prod | ||
prod: | ||
- docker container stop blitzed | ||
- docker container rm blitzed | ||
- docker image rm blitzed | ||
docker build -t blitzed:latest . | ||
prisma migrate deploy | ||
docker run --env-file .env -p 4000:3000 --name blitzed -d blitzed:latest |
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