Skip to content

Commit

Permalink
test:docker img push
Browse files Browse the repository at this point in the history
  • Loading branch information
redgreat committed Apr 16, 2024
1 parent 2476333 commit 4f394ef
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 27 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/dockerpush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 推送docker镜像

on:
push:
branches: [main]

env:
OTP-VERSION: 26.2.2
REBAR3-VERSION: 3.22.1

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- uses: erlef/setup-beam@v1.17.5
with:
otp-version: ${{ env.OTP-VERSION }}
rebar3-version: ${{ env.REBAR3-VERSION }}

- uses: actions/cache@v4.0.2
id: rebar3-cache
with:
path: |
~/.cache/rebar3
_build
key: ${{ runner.os }}-${{ env.OTP-VERSION }}-${{ env.REBAR3-VERSION }}-${{ hashFiles('rebar.lock') }}

- name: compile
run: |
rebar3 clean
rebar3 as prod release
tar -czvf eadm-${{ github.ref_name }}.tar.gz _build/prod/rel/eadm
- name: docker build
id: buildx
uses: docker/setup-buildx-action@v3.3.0

- name: dockerhub login
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: docker image build & push
id: docker_build
uses: docker/build-push-action@v5.3.0
with:
context: .
push: true
tags: redgreat/eadm:${{ github.ref_name }}

- name: docker image build & push
id: docker_build
uses: docker/build-push-action@v5.3.0
with:
context: .
push: true
tags: redgreat/eadm:latest
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: 编译发包并推送docker镜像
name: 发包

on:
# push:
# branches: [main]

push:
tags:
- 'v*'
Expand Down Expand Up @@ -42,28 +39,6 @@ jobs:
rebar3 as prod release
tar -czvf eadm-${{ github.ref_name }}.tar.gz _build/prod/rel/eadm
# 设置Docker构建环境
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.3.0

# 登录Docker Hub
- name: Login to DockerHub
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# 构建Docker镜像
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v5.3.0
with:
context: .
push: true
tags: redgreat/eadm:latest

# 创建release包
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -75,7 +50,6 @@ jobs:
draft: false
prerelease: false

# 发布release包
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
Expand Down

0 comments on commit 4f394ef

Please sign in to comment.