#Deploying my java app to VPS with Github actions and Dockerization

5 messages · Page 1 of 1 (latest)

ornate cedar
#

This is the deployment code I got from our existing project

name: build and deploy movie app  service backend  
  
on:  
  push:  
    branches:  
      - dev  
  
jobs:  
  build-deploy:  
    name: build and deploy city-app-movie-backend  
    runs-on: ubuntu-22.04  
  
    steps:  
      - name: checkout code  
        uses: actions/checkout@v3  
  
      - name: setup jdk 21  
        uses: actions/setup-java@v3  
        with:  
          distribution: 'corretto'  
          java-version: 21  
  
      - name: grant execute permission for gradlew  
        run: chmod +x ./gradlew  
  
      - name: build the app  
        run: ./gradlew clean build -x test  
  
      - name: login to docker hub  
        uses: docker/login-action@v1  
        with:  
          username: ragjn_the_goat  
          password: password  
  
      - name: push the docker image to docker hub  
        uses: docker/build-push-action@v4  
        with:  
          context: .  
          dockerfile: Dockerfile  
          push: true  
          tags: rag_jn_ep/city-app-movie-backend:latest  
  
      - name: Deploy on contabo  
        env:  
          SSH_PASS: rag_the_goat  
        run: |  
          sshpass -p "$SSH_PASS" ssh -o StrictHostKeyChecking=no [email protected] << EOF  
            #Stop the existing container  
            docker stop city-app-movie-backend || true  
            docker rm city-app-movie-backend || true  
            docker pull rag_jn_ep/city-app-movie-backend:latest  
            docker run --name city-app-movie-backend -d -p 8086:8086 -p 9002:9002 --network my-bridge-network \  
           --mount type=bind,source=/var/log/movie-service,target=/logs \  
          rag_jn_ep/city-app-movie-backend:latest  
          EOF
sweet pineBOT
#

This post has been reserved for your question.

Hey @ornate cedar! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

ornate cedar
#

So I assume

I don't have to create any containers in the server, I just have to push this to github, and it will create the container?

#

I don't know where to start from?