Skip to content

Commit ed32409

Browse files
authored
Merge pull request nicolaka#74 from nicolaka/test
automating build and push with Github Actions to support arm64 and x86
2 parents 1d6dc22 + 41ef0c5 commit ed32409

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.github/workflows/docker-buildx.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,22 @@ jobs:
2424
-
2525
name: Available platforms
2626
run: echo ${{ steps.buildx.outputs.platforms }}
27+
-
28+
name: docker login
29+
env:
30+
DOCKER_USER: ${{secrets.DOCKER_USER}}
31+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
32+
run: |
33+
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
2734
-
2835
name: Run Buildx
2936
run: |
3037
docker buildx build \
3138
--platform linux/amd64,linux/arm64 \
32-
--output "type=image,push=false" \
33-
--file ./Dockerfile .
39+
--output "type=image,push=true" \
40+
--file ./Dockerfile \
41+
--tag $GITHUB_REPOSITORY:$GITHUB_SHA \
42+
--tag $GITHUB_REPOSITORY:latest .
43+
44+
45+

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ RUN set -ex \
5252
py3-setuptools \
5353
scapy \
5454
socat \
55+
speedtest-cli \
5556
strace \
5657
tcpdump \
5758
tcptraceroute \

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.PHONY: build-x86 build-arm64 push all
2+
3+
# Build Vars
4+
IMAGENAME=nicolaka/netshoot
5+
VERSION=0.1
6+
7+
8+
.DEFAULT_GOAL := all
9+
10+
build-x86:
11+
@docker build --platform linux/amd64 -t ${IMAGENAME}:${VERSION} .
12+
build-arm64:
13+
@docker build --platform linux/arm64 -t ${IMAGENAME}:${VERSION} .
14+
build-all:
15+
@docker buildx build --platform linux/amd64,linux/arm64 --output "type=image,push=false" --file ./Dockerfile .
16+
push:
17+
@docker push ${IMAGENAME}:${VERSION}
18+
all: build-all push
19+
20+
21+

0 commit comments

Comments
 (0)