fix pnpm install fail inside docker #83
This file contains hidden or 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 Web to Development | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| paths: | |
| - "apps/web/**" | |
| - "infra/docker-compose.web.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| name: Build and Push Docker Image to GHCR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker image | |
| run: | | |
| docker build \ | |
| --platform linux/amd64 \ | |
| -t ghcr.io/${{ github.repository_owner }}/core-web:dev \ | |
| --file ./apps/web/Dockerfile \ | |
| --target prod \ | |
| ./apps/web | |
| - name: Push Docker image | |
| run: | | |
| docker push ghcr.io/${{ github.repository_owner }}/core-web:dev | |
| deploy: | |
| name: Deploy to Development Server | |
| runs-on: ubuntu-latest | |
| needs: [build-and-push] | |
| steps: | |
| - name: SSH proxy commmand | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.WEB_HOST }} | |
| username: root | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| # password: ${{ secrets.WEB_PASSWORD }} | |
| script: | | |
| cd /root/core/infra | |
| git fetch | |
| git checkout dev | |
| git reset --hard origin/dev | |
| git pull | |
| export INFISICAL_TOKEN=$(infisical login \ | |
| --method=universal-auth \ | |
| --client-id='${{ secrets.INFISICAL_CLIENT_ID }}' \ | |
| --client-secret='${{ secrets.INFISICAL_CLIENT_SECRET }}' \ | |
| --silent \ | |
| --plain) | |
| infisical export \ | |
| --token=$INFISICAL_TOKEN \ | |
| --env=dev \ | |
| --format=dotenv \ | |
| --path="/web" \ | |
| --projectId='${{ secrets.INFISICAL_PROJECT_ID }}' \ | |
| > ./secrets/.env.dev.web | |
| docker compose -f docker-compose.web.yml pull web-dev caddy | |
| docker compose -f docker-compose.web.yml up -d --no-deps --force-recreate web-dev caddy |