@@ -25,27 +25,68 @@ jobs:
2525 run : |
2626 echo "No tests configured. Passing by default."
2727
28- # build_and_push:
29- # needs: test
30- # runs-on: ubuntu-latest
31- # if: github.event_name == 'push' && github.ref == 'refs/heads/main'
32- # steps:
33- # - uses: actions/checkout@v3
34- #
35- # - name: Set up Docker Buildx
36- # uses: docker/setup-buildx-action@v2
37- #
38- # - name: Log in to GitHub Container Registry
39- # uses: docker/login-action@v2
40- # with:
41- # registry: ghcr.io
42- # username: ${{ github.actor }}
43- # password: ${{ secrets.GITHUB_TOKEN }}
44- #
45- # - name: Build and push server image with cache
46- # uses: docker/build-push-action@v4
47- # with:
48- # context: .
49- # file: ./Infrastructure/Dockerfile.server
50- # push: true
51- # tags: ghcr.io/${{ github.repository](#)
28+ build_and_push :
29+ needs : test
30+ runs-on : ubuntu-latest
31+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
32+ steps :
33+ - uses : actions/checkout@v3
34+
35+ - name : Set up Docker Buildx
36+ uses : docker/setup-buildx-action@v2
37+
38+ - name : Log in to GitHub Container Registry
39+ uses : docker/login-action@v2
40+ with :
41+ registry : ghcr.io
42+ username : ${{ github.actor }}
43+ password : ${{ secrets.GITHUB_TOKEN }}
44+
45+ - name : Build and push server image with cache
46+ uses : docker/build-push-action@v4
47+ with :
48+ context : .
49+ file : ./Infrastructure/Dockerfile.server
50+ push : true
51+ tags : ghcr.io/${{ github.repository_owner }}/nexapod-server:latest
52+ cache-from : type=gha
53+ cache-to : type=gha,mode=max
54+
55+ - name : Build and push client image with cache
56+ uses : docker/build-push-action@v4
57+ with :
58+ context : .
59+ file : ./Infrastructure/Dockerfile.client
60+ push : true
61+ tags : ghcr.io/${{ github.repository_owner }}/nexapod-client:latest
62+ cache-from : type=gha
63+ cache-to : type=gha,mode=max
64+
65+ # deploy:
66+ # needs: build_and_push
67+ # runs-on: ubuntu-latest
68+ # steps:
69+ # - name: Deploy to DigitalOcean
70+ # uses: appleboy/ssh-action@master
71+ # with:
72+ # host: ${{ secrets.DO_HOST }}
73+ # username: ${{ secrets.DO_USERNAME }}
74+ # key: ${{ secrets.DO_SSH_KEY }}
75+ # script: |
76+ # OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
77+ # # Log in to GHCR using a long-lived Deploy Token
78+ # echo ${{ secrets.DEPLOY_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
79+ #
80+ # # Stop and remove the old container if it exists
81+ # docker stop nexapod-server || true
82+ # docker rm nexapod-server || true
83+ #
84+ # # Pull the latest server image
85+ # docker pull ghcr.io/$OWNER_LC/nexapod-server:latest
86+ #
87+ # # Run the new container
88+ # docker run -d \
89+ # --name nexapod-server \
90+ # --restart always \
91+ # -p 8000:8000 \
92+ # ghcr.io/$OWNER_LC/nexapod-server:latest
0 commit comments