-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from JupiterBroadcasting/infra/automated_depl…
…oyment Infra/automated deployment
- Loading branch information
Showing
3 changed files
with
47 additions
and
4 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,33 @@ | ||
name: Deploy to VPS | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Build | ||
- name: Pull latest changes on VPS | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.VPS_HOST }} | ||
USERNAME: ${{ secrets.VPS_DEPLOY_USER }} | ||
PORT: ${{ secrets.VPS_SSH_PORT }} | ||
KEY: ${{ secrets.VPS_SSHKEY }} | ||
script: cd ${{ secrets.VPS_PROJECT_PATH }} && git fetch && git pull | ||
|
||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.VPS_HOST }} | ||
USERNAME: ${{ secrets.VPS_DEPLOY_USER }} | ||
PORT: ${{ secrets.VPS_SSH_PORT }} | ||
KEY: ${{ secrets.VPS_SSHKEY }} | ||
script: cd ${{ secrets.VPS_PROJECT_PATH }} && make deploy-prod |
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,8 @@ | ||
FROM registry.gitlab.com/pages/hugo/hugo_extended:0.101.0 | ||
CMD [ "serve", "-D", "--bind", "0.0.0.0" ] | ||
ENTRYPOINT [ "hugo" ] | ||
FROM registry.gitlab.com/pages/hugo/hugo_extended:0.101.0 as builder | ||
WORKDIR /site | ||
COPY . /site | ||
RUN hugo | ||
|
||
FROM nginx:alpine | ||
RUN rm -rf /usr/share/nginx/html/* | ||
COPY --from=builder /site/public /usr/share/nginx/html |
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,8 @@ | ||
dev: | ||
docker build --rm -f Dockerfile -t jb_hugo:latest . | ||
docker run --rm -it -v "$${PWD}":/app -w /app -p $${HOST_IP:-127.0.0.1}:1313:1313 jb_hugo:latest | ||
docker run --rm -it -v "$${PWD}":/app -w /app -p $${HOST_IP:-127.0.0.1}:1313:1313 jb_hugo:latest | ||
|
||
deploy-prod: | ||
docker build -t jb-jbcom . | ||
docker-compose -f ~/docker-compose.yml up -d jb-jbcom | ||
docker image prune -af |