Skip to content

Commit

Permalink
Deploy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Einlar committed May 14, 2024
1 parent bfc5146 commit 03f253d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build & Deploy

on:
push:
branches: ["main"]

pull_request:
branches: ["main"]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build --if-present
- uses: a7ul/tar-action@v1.1.0
with:
command: c
cwd: "./"
files: |
./dist
Dockerfile
default.conf
captain-definition
outPath: deploy.tar

- name: Deploy App to CapRover
uses: caprover/deploy-from-github@v1.0.1
with:
server: "${{ secrets.CAPROVER_SERVER }}"
app: "${{ secrets.CAPROVER_NAME }}"
token: "${{ secrets.CAPROVER_KEY }}"
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# production environment
FROM nginx:stable-alpine
RUN rm -rf /etc/nginx/conf.d
RUN mkdir -p /etc/nginx/conf.d
COPY ./default.conf /etc/nginx/conf.d/
COPY ./dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
4 changes: 4 additions & 0 deletions captain-definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile"
}
12 changes: 12 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit 03f253d

Please sign in to comment.