mirror of
https://github.com/artegoser/AnoPaper.git
synced 2024-11-05 12:33:58 +03:00
ci: caprover docker deploy
This commit is contained in:
parent
631dd28d9a
commit
eadfa51b5f
2 changed files with 40 additions and 2 deletions
38
.github/workflows/deploy.yml
vendored
Normal file
38
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: Build and Deploy Docker Image
|
||||
on: [push]
|
||||
jobs:
|
||||
build_and_deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Preset Image Name
|
||||
run: echo "IMAGE_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push Docker Image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ env.IMAGE_URL }}
|
||||
|
||||
- name: Deploy Image to CapRrover
|
||||
uses: caprover/deploy-from-github@v1.1.2
|
||||
with:
|
||||
server: "${{ secrets.CAPROVER_SERVER }}"
|
||||
app: "${{ secrets.APP_NAME }}"
|
||||
token: "${{ secrets.APP_TOKEN }}"
|
||||
image: ${{ env.IMAGE_URL }}
|
|
@ -6,8 +6,8 @@ RUN npm run build
|
|||
|
||||
FROM node:18-alpine as run
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/package*.json /app/index.js /app/note_validator.js /app/core.js /usr/src/app/
|
||||
COPY --from=build /app/dist/ /usr/src/app/dist/
|
||||
COPY --from=build /app/package*.json /app/index.js /app/note_validator.js /app/core.js ./
|
||||
COPY --from=build /app/dist/ ./dist/
|
||||
RUN npm install --omit=dev
|
||||
CMD npm run start
|
||||
EXPOSE 80
|
||||
|
|
Loading…
Reference in a new issue