From 95a1aeaddb3e22e7ca1caf6e5072544b951caa12 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Nakazone Batista Date: Mon, 5 Sep 2022 04:21:18 -0300 Subject: [PATCH] Create docker-image.yml --- .github/workflows/docker-image.yml | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..68f0695 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,68 @@ +name: ci + +on: + push: + branches: + - 'main' + +jobs: + + build: + + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:11 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: portfolio + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + env: + FRONT_END_PATH: 'localhost:5000' + FRONT_END_CONNECTION_TYPE: 'unsecure' + PORT: 8070 + DATABASE_URL: 'postgresql://localhost:5432/portfolio' + DATABASE_USER: 'postgres' + DATABASE_PASSWORD: 'postgres' + run: ./mvnw -B package --file pom.xml + + docker: + + + needs: [build] + runs-on: ubuntu-latest + steps: + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + tags: yoshiunfriendly/backend-hideyoshi.com:latest