Skip to content

Commit 7e1e22e

Browse files
committed
docs: add README [skip ci]
1 parent c48c945 commit 7e1e22e

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,84 @@
11
# docker-actions
2+
3+
[![Test Actions](https://github.com/go-cross/docker-actions/actions/workflows/test-actions.yml/badge.svg)](https://github.com/go-cross/docker-actions/actions/workflows/test-actions.yml)
4+
25
Build golang program with CGO_ENABLED=1 for docker Image
6+
7+
### Usage Example
8+
9+
```yml
10+
name: Docker Actions
11+
12+
on:
13+
pull_request:
14+
branches:
15+
- main
16+
push:
17+
branches:
18+
- main
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
test-action:
25+
name: GitHub Actions Test
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout
30+
id: checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Go
34+
uses: actions/setup-go@v5
35+
with:
36+
go-version: '1.22'
37+
38+
- name: Build docker binary
39+
id: docker-build
40+
uses: go-cross/docker-actions@v1
41+
with:
42+
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x
43+
44+
- name: Docker meta
45+
id: meta
46+
uses: docker/metadata-action@v5
47+
with:
48+
images: xhofe/test
49+
50+
- name: Set up QEMU
51+
uses: docker/setup-qemu-action@v3
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Build and push
57+
id: docker_build
58+
uses: docker/build-push-action@v5
59+
with:
60+
context: .
61+
file: ./example/Dockerfile
62+
push: false
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
65+
platforms: ${{ steps.docker-build.outputs.platforms }}
66+
```
67+
68+
Sure, here are the inputs and outputs in table format:
69+
70+
## Inputs
71+
72+
| Input | Description | Required | Default Value |
73+
| --------- | ----------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
74+
| platforms | The platforms to build for | No | 'linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x' |
75+
| dir | The directory to work | No | '.' |
76+
| packages | The packages to build | No | '.' |
77+
| flags | The flags to pass to the go build command | No | '-ldflags=-w -s' |
78+
| output | The output binary name | No | '$repo' |
79+
80+
## Outputs
81+
82+
| Output | Description |
83+
| --------- | ----------------------- |
84+
| platforms | The platforms built for |

0 commit comments

Comments
 (0)