Skip to content

Commit

Permalink
testing aws deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
LazaroQueiroz committed Nov 12, 2024
1 parent e8b0ccd commit 6df5871
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions .github/workflows/deploy-oca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,60 @@ on:
branch: "teste-deploy-aws"

jobs:
build:
runs-on: [x1-aws-self-hosted-runner, x2-aws-self-hosted-runner]
build-1:
runs-on: [x1-aws-self-hosted-runner, self-hosted]
steps:
- uses: actions/checkout@v4

- name: Update docker metadata with the tag
uses: docker/metadata-action@v4
id: meta
with:
images: ${{ vars.DOCKER_IMAGE_PROD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
file: Dockerfile.production
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ vars.DOCKER_IMAGE_PROD }}:latest
${{ steps.meta.outputs.tags }}
build-args: |
NEXT_PUBLIC_HOST_URL=${{ vars.NEXT_PUBLIC_HOST_URL }}
NEXT_PUBLIC_GEE_PRIVATE_KEY=${{ secrets.NEXT_PUBLIC_GEE_PRIVATE_KEY }}
NEXT_PUBLIC_GA_ID=${{ secrets.NEXT_PUBLIC_GA_ID }}
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN=${{ secrets.NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN }}
NEXT_PUBLIC_CONTENTFUL_SPACE=${{ secrets.NEXT_PUBLIC_CONTENTFUL_SPACE }}
NEXT_PUBLIC_MAIL_APP_TO=${{ vars.NEXT_PUBLIC_MAIL_APP_TO }}
NEXT_PUBLIC_MAIL_APP_CC=${{ vars.NEXT_PUBLIC_MAIL_APP_CC }}
NEXT_PUBLIC_MAIL_APP_USER=${{ vars.NEXT_PUBLIC_MAIL_APP_USER }}
NEXT_PUBLIC_MAIL_APP_PASS=${{ secrets.NEXT_PUBLIC_MAIL_APP_PASS }}
- name: Pull the latest image
run: sudo docker pull ${{ vars.DOCKER_IMAGE_PROD }}:latest

- name: Stop existing container
run: sudo docker rm -f ${{ vars.CONTAINER_NAME_PROD }} || true

- name: Run new container
run: sudo docker run --name ${{ vars.CONTAINER_NAME_PROD }} -p ${{ vars.HOST_PORT_PROD }}:${{ vars.CONTAINER_PORT }} -d ${{ vars.DOCKER_IMAGE_PROD }}:latest

- name: Prune unused Docker images
run: sudo docker system prune -f
build-2:
runs-on: [x2-aws-self-hosted-runner, self-hosted]
steps:
- uses: actions/checkout@v4

Expand Down

0 comments on commit 6df5871

Please sign in to comment.