-
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.
- Loading branch information
1 parent
60b8924
commit 534bb56
Showing
1 changed file
with
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Deploy Go Application | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
- name: Create .env file | ||
run: echo "PORT=${{ secrets.PORT }}" >> .env | ||
- name: Login to docker hub | ||
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build docker image | ||
run: docker build -t aadityaguptaa/snipd-docker . | ||
- name: Push image to docker hub | ||
run: docker push aadityaguptaa/snipd-docker:latest | ||
deploy: | ||
needs: build | ||
runs-on: self-hosted | ||
steps: | ||
- name: Pull docker image | ||
run: docker pull aadityaguptaa/snipd-docker:latest | ||
- name: Delete old container | ||
run: docker rm -f go-app-container | ||
- name: Run docker container | ||
run: docker run -d -p 4040:4040 --name go-app-container aadityaguptaa/snipd-docker |