Skip to content

PRを作成した際にビルドする #24

PRを作成した際にビルドする

PRを作成した際にビルドする #24

name: Build and Push Multiple Docker Images
on:
pull_request:
types: [opened, synchronize, reopened, closed]
jobs:
build-and-push:
runs-on: ubuntu-latest
if: |
github.event.pull_request.merged == true ||
github.event.action == 'opened' ||
github.event.action == 'synchronize' ||
github.event.action == 'reopened'
strategy:
matrix:
include:
- dockerfile: admin.k8s.Dockerfile
image_name: nutfes/group-manager-2-admin-view
- dockerfile: front.k8s.Dockerfile
image_name: nutfes/group-manager-2-user-front
- dockerfile: api.k8s.Dockerfile
image_name: nutfes/group-manager-2-api
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ matrix.image_name }}:latest
build-args: |
API_URL=https://group-manager-api.nosse.net
APP_API_URL=https://group-manager-api.nosse.net
CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }}
CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }}