diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml deleted file mode 100644 index 36e1fbd..0000000 --- a/.github/workflow/main.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: CICD Pipeline - -on: - push: - branches: [ "main" ] - # paths: - # - 'WebsocketServer/**' - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Login Dockerhub - - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - - - name: Build the Docker image - run: docker build -t axnjr/ignition_wsss . - - name: Push to Dockerhub - run: docker push axnjr/ignition_wsss:latest - - deploy: - needs: build - runs-on: [ignition_wsss_aws_runner] - steps: - - name: Pulling image from docker hub - run: docker pull axnjr/ignition_wsss:latest - - name: Deleting older container - run: docker rm -f axnjr/ignition_wsss - - name: Run docker container - run: docker run -e DB_URL=${{ secrets.DB_URL }} -e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} -e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} -e REGION=${{ secrets.REGION }} -e PORT=${{ secrets.PORT }} --network host --name ignition_wsss axnjr/ignition_wsss:latest \ No newline at end of file diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index e05cbad..ead1608 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -11,18 +11,21 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Login Dockerhub + - uses: actions/checkout@v3 - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - - - name: Build the Docker image - run: docker build -t axnjr/ignition_wsss . - - name: Push to Dockerhub - run: docker push axnjr/ignition_wsss:latest + - name: Loging in to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: ./WebsocketServer + file: ./WebsocketServer/Dockerfile + push: true + tags: axnjr/ignition_wsss:latest deploy: needs: build