Merge pull request #1 from HideyoshiNakazone/develop-push-docker-image

Create docker-image.yml
This commit is contained in:
2022-09-05 04:21:28 -03:00
committed by Vitor Hideyoshi
4 changed files with 71 additions and 29 deletions

68
.github/workflows/docker-image.yml vendored Normal file
View File

@@ -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

View File

@@ -1,26 +0,0 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml

View File

@@ -13,7 +13,7 @@ import java.util.List;
@Configuration
public class CorsConfig {
@Value("${com.hideyoshi.frontendPath}")
@Value("${com.hideyoshi.frontEndPath}")
private String FRONTEND_PATH;
@Value("${com.hideyoshi.frontendConnectionType}")

View File

@@ -1,7 +1,7 @@
com:
hideyoshi:
frontEndPath: ${FRONTEND_PATH}}
frontendConnectionType: ${FRONTEND_CONNECTION_TYPE}}
frontEndPath: ${FRONTEND_PATH}
frontendConnectionType: ${FRONTEND_CONNECTION_TYPE}
tokenSecret: ${TOKEN_SECRET}
accessTokenDuration: ${ACCESS_TOKEN_DURATION}
refreshTokenDuration: ${REFRESH_TOKEN_DURATION}