Skip to content

Merge remote-tracking branch 'origin/common' into user/dev #39

Merge remote-tracking branch 'origin/common' into user/dev

Merge remote-tracking branch 'origin/common' into user/dev #39

name: User Service Docker Hub Push
on:
push:
branches:
- 'user/dev'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x src/user-service/gradlew
- name: Build and Push Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PASSPORT_KEY: ${{ secrets.PASSPORT_KEY }}
PASSPORT_ALGORITHM: ${{ secrets.PASSPORT_ALGORITHM }}
USER_DB_URI: ${{ secrets.USER_DB_URI }}
USER_DB_USERNAME: ${{ secrets.USER_DB_USERNAME }}
USER_DB_PASSWORD: ${{ secrets.USER_DB_PASSWORD }}
run: |
cd src/user-service
./gradlew clean build -x test
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --use
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx build --platform=linux/amd64,linux/arm64 -t $DOCKER_USERNAME/user-service:latest . --push