Skip to content

Commit bd42d78

Browse files
committed
Add arm64 support using buildx
Signed-off-by: odidev <[email protected]>
1 parent abc9675 commit bd42d78

File tree

2 files changed

+39
-30
lines changed

2 files changed

+39
-30
lines changed

.travis.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
sudo: required
2+
3+
dist: focal
4+
25
services:
36
- docker
47

8+
before_script:
9+
- mkdir -p ~/.docker/cli-plugins
10+
- wget -O - https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64 > ~/.docker/cli-plugins/docker-buildx
11+
- chmod a+x ~/.docker/cli-plugins/docker-buildx
12+
- docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
13+
- docker buildx create --use --name mybuilder
14+
515
script:
6-
- echo "Build local image"
7-
- docker build -t filebeat .
8-
- docker images
9-
- echo "Run local image"
10-
- docker run -d --name filebeat filebeat
11-
- docker ps -a
12-
- docker logs filebeat
16+
- echo "Build and push both amd64 and arm64 images"
17+
- docker login -u ${USERNAME} -p ${PASSWORD}
18+
- docker buildx build --platform linux/amd64,linux/arm64 -t ${USERNAME}/filebeat:latest --push .
1319
- echo "Testing public image on Docker Hub"
14-
- docker run -d --name nguoianphu-filebeat nguoianphu/docker-filebeat
20+
- docker run -d --name filebeat-container ${USERNAME}/filebeat:latest
1521
- docker ps -a
16-
- docker logs nguoianphu-filebeat
17-
- docker images
22+
- docker logs filebeat-container

Dockerfile

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,37 @@
55

66
# Alpine OS 3.4
77
# http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/
8-
FROM alpine:3.4
8+
FROM alpine:latest
99

1010
MAINTAINER Tuan Vo <[email protected]>
1111

1212
###############################################################################
1313
# INSTALLATION
1414
###############################################################################
1515

16-
ENV FILEBEAT_VERSION=5.0.0
17-
18-
RUN set -x \
19-
&& apk add --update bash \
20-
curl \
21-
tar \
22-
openssl \
23-
&& curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${FILEBEAT_VERSION}-linux-x86_64.tar.gz \
24-
&& tar xzvf filebeat-${FILEBEAT_VERSION}-linux-x86_64.tar.gz -C / --strip-components=1 \
25-
&& rm -rf filebeat-${FILEBEAT_VERSION}-linux-x86_64.tar.gz \
26-
&& apk --no-cache add ca-certificates \
27-
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \
28-
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk \
29-
&& apk add glibc-2.23-r3.apk \
30-
&& apk del curl \
31-
tar \
32-
openssl \
33-
&& rm -rf /var/cache/apk/*
34-
16+
ENV FILEBEAT_VERSION=7.14.0
17+
18+
RUN if [ `uname -m` = "aarch64" ] ; then \
19+
arch="arm64"; \
20+
else \
21+
arch="x86_64"; \
22+
fi \
23+
&& set -x \
24+
&& apk add --update bash \
25+
curl \
26+
tar \
27+
openssl \
28+
&& curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${FILEBEAT_VERSION}-linux-${arch}.tar.gz \
29+
&& tar xzvf filebeat-${FILEBEAT_VERSION}-linux-${arch}.tar.gz -C / --strip-components=1 \
30+
&& rm -rf filebeat-${FILEBEAT_VERSION}-linux-${arch}.tar.gz \
31+
&& apk --no-cache add ca-certificates \
32+
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
33+
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk \
34+
&& apk add glibc-2.34-r0.apk \
35+
&& apk del curl \
36+
tar \
37+
openssl \
38+
&& rm -rf /var/cache/apk/*
3539
###############################################################################
3640
# START
3741
###############################################################################

0 commit comments

Comments
 (0)