dockerignore, revert to npm install #107
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
name: Deploy to production | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Docker image build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node and install dependencies | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17.0" | |
- name: Login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build docker image | |
run: | | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/backoffice \ | |
--build-arg VITE_BASE_URL=${{ secrets.VITE_BASE_URL }} \ | |
--target=production . | |
- name: Push docker image to Docker Hub | |
run: docker push ${{ secrets.DOCKER_USERNAME }}/backoffice:latest | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
name: Deployment | |
steps: | |
- name: Deploy using SSH | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: 22 | |
script: | | |
cd backoffice; | |
git pull; | |
docker stop backoffice; | |
docker rm backoffice; | |
docker pull akmatoff/backoffice:latest; | |
docker run --restart always -d -p 4000:4000 --name backoffice akmatoff/backoffice:latest |