Skip to content

Commit

Permalink
fix(ci): Clean up multi arch build (#885)
Browse files Browse the repository at this point in the history
* fix(ci): fix release github action

* rename

* delete Dockerfile of building in docker
  • Loading branch information
whynowy authored Sep 25, 2020
1 parent 3cf9254 commit 43f5031
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 174 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/docker-image.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,16 @@ jobs:
files: release.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Login
uses: Azure/docker-login@v1
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_PASSWORD }}

- name: Build & Push Linux Docker Images
env:
DOCKERIO_ORG: ${{ secrets.DOCKERIO_ORG }}
run: |
tag=$(basename $GITHUB_REF)
make eventsource-image sensor-image eventbus-controller-image eventsource-controller-image sensor-controller-image IMAGE_TAG=${tag} IMAGE_NAMESPACE=${DOCKERIO_ORG} DOCKER_PUSH=true
87 changes: 17 additions & 70 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,96 +1,44 @@
####################################################################################################
# Builder image
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
# base
####################################################################################################
FROM golang:1.13.4 as builder

RUN apt-get update && apt-get --no-install-recommends install -y \
git \
make \
apt-utils \
apt-transport-https \
ca-certificates \
wget \
gcc \
zip && \
apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base

WORKDIR /tmp

####################################################################################################
# Argo Build stage which performs the actual build of Argo binaries
####################################################################################################
FROM builder as build

ARG IMAGE_OS=linux

# Perform the build
WORKDIR /go/src/github.com/argoproj/argo-events
COPY . .
# check we can use Git
RUN git rev-parse HEAD

# Make sure there are not prebuilt binaries
RUN rm dist/*

# eventbus-controller
RUN . hack/image_arch.sh && make dist/eventbus-controller-linux-${IMAGE_ARCH}

# eventsource-controller
RUN . hack/image_arch.sh && make dist/eventsource-controller-linux-${IMAGE_ARCH}

# sensor-controller
RUN . hack/image_arch.sh && make dist/sensor-controller-linux-${IMAGE_ARCH}

# eventsource
RUN . hack/image_arch.sh && make dist/eventsource-linux-${IMAGE_ARCH}

# sensor
RUN . hack/image_arch.sh && make dist/sensor-linux-${IMAGE_ARCH}

FROM golang:alpine as base
RUN apk --update add ca-certificates
RUN apk --no-cache add tzdata

####################################################################################################
# eventbus-controller
####################################################################################################
FROM scratch as eventbus-controller
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/eventbus-controller /bin/eventbus-controller
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY dist/eventbus-controller /bin/eventbus-controller
ENTRYPOINT [ "/bin/eventbus-controller" ]

####################################################################################################
# eventsource-controller
####################################################################################################
FROM scratch as eventsource-controller
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/eventsource-controller /bin/eventsource-controller
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY dist/eventsource-controller /bin/eventsource-controller
ENTRYPOINT [ "/bin/eventsource-controller" ]

####################################################################################################
# sensor-controller
####################################################################################################
FROM scratch as sensor-controller
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/sensor-controller /bin/sensor-controller
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY dist/sensor-controller /bin/sensor-controller
ENTRYPOINT [ "/bin/sensor-controller" ]

####################################################################################################
# eventsource
####################################################################################################
FROM scratch as eventsource
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/eventsource /bin/eventsource
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY dist/eventsource /bin/eventsource
ENTRYPOINT [ "/bin/eventsource" ]

####################################################################################################
Expand All @@ -108,7 +56,6 @@ COPY assets/argo-linux-amd64 /usr/local/bin/argo
RUN chmod +x /usr/local/bin/argo
RUN argo version || true

COPY --from=build /go/src/github.com/argoproj/argo-events/dist/sensor /bin/sensor
COPY dist/sensor /bin/sensor

ENTRYPOINT [ "/bin/sensor" ]

61 changes: 0 additions & 61 deletions Dockerfile.dev

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PACKAGE=github.com/argoproj/argo-events
CURRENT_DIR=$(shell pwd)
DIST_DIR=${CURRENT_DIR}/dist

DOCKERFILE:=Dockerfile.dev
DOCKERFILE:=Dockerfile

VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
Expand Down

0 comments on commit 43f5031

Please sign in to comment.