Skip to content

Commit

Permalink
multi-arch build
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Wang committed Jan 9, 2024
1 parent c60393d commit 3693259
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
49 changes: 45 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,34 @@ jobs:
- image: alpine/docker-with-buildx
environment:
REBUILD: << pipeline.parameters.rebuild >>
APPLICATIONS: dfimage
steps:
- checkout
- setup_remote_docker:
version: 18.09.3
- run: |
apk --no-cache --update add bash curl sudo git uuidgen
apk --no-cache --update add bash curl jq uuidgen
echo $REBUILD
commit=$(git rev-parse --short HEAD)
bash ./build.sh dfimage $commit
# build the application with latest tag
for app in ${APPLICATIONS}
do
bash -x ./build.sh ${app}
done
scan:
docker:
- image: alpine/trivy
environment:
APPLICATIONS: dfimage
steps:
- checkout
- run: |
for app in ${APPLICATIONS}
do
echo "Scan image alpine/${app} ..."
trivy image -s "HIGH,CRITICAL" alpine/${app}
echo "==== End of Scan ===="
done
workflows:
build:
Expand All @@ -41,11 +60,22 @@ workflows:
only:
- master
- main
- scan:
requires:
- build
name: scan
context:
- Docker-Hub
filters:
branches:
only:
- master
- main

nightly:
triggers:
- schedule:
cron: "0 3 * * 0"
cron: "0 3 * * 6"
filters:
branches:
only:
Expand All @@ -62,3 +92,14 @@ workflows:
- master
- main

- scan:
requires:
- build
name: scan
context:
- Docker-Hub
filters:
branches:
only:
- master
- main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.idea/

WhaleTail
functions.sh
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang AS builder
FROM golang:1.14.4 AS builder
ADD ./ /root/whaler_build
WORKDIR /root/whaler_build
RUN export CGO_ENABLED=0 && go build .
RUN cp whaler /root/whaler

FROM alpine
WORKDIR /root/
COPY --from=builder /root/whaler /usr/bin/whaler
ENTRYPOINT ["/usr/bin/whaler"]
COPY --from=builder /root/whaler .
ENTRYPOINT ["./whaler"]
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ platform="linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,linux/s390x"
curl -H "Cache-Control: no-cache" -sL "https://raw.githubusercontent.com/alpine-docker/multi-arch-libs/stable/functions.sh" -o functions.sh
source functions.sh

tag="latest"
tag=$(get_latest_release alpine-docker/dfimage)
build_arg="VERSION-${tag}"

echo "build image for ${tag}"
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"path/filepath"
"net/url"
"fmt"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/term"
"github.com/moby/moby/pkg/jsonmessage"
"github.com/moby/term"
)

const FilePerms = 0700
Expand Down

0 comments on commit 3693259

Please sign in to comment.