new dockerfile #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16.x" | |
- name: Bump Version | |
id: bump | |
uses: opspresso/action-builder@master | |
with: | |
args: --version | |
- name: Release to GitHub | |
uses: opspresso/action-builder@master | |
with: | |
args: --release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ steps.bump.outputs.version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
nalbam/${{ github.event.repository.name }} | |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} | |
${{ steps.login-ecr.outputs.registry }}/nalbam/${{ github.event.repository.name }} | |
tags: | | |
type=semver,pattern={{raw}},value=${{ steps.bump.outputs.version }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# - name: Trigger for GitOps | |
# uses: opspresso/action-builder@master | |
# with: | |
# args: --dispatch | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GHP_TOKEN }} | |
# GITOPS_REPO: "opspresso/argocd-env-demo" | |
# PROJECT: ${{ github.event.repository.name }} | |
# VERSION: ${{ steps.bump.outputs.version }} |