Skip to content

Commit

Permalink
Merge pull request #57 from thedadams/use-sles-image
Browse files Browse the repository at this point in the history
Use same SLES image as Rancher
  • Loading branch information
Donnie Adams authored Jun 28, 2021
2 parents 32889b9 + 520d9f5 commit c0f8cbe
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
22 changes: 22 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ steps:
event:
- tag

- name: docker-build
image: plugins/docker
settings:
dockerfile: package/Dockerfile
repo: "rancher/gke-operator"
tag: "${DRONE_COMMIT}-amd64"
dry_run: true
when:
event:
- pull_request

volumes:
- name: docker
host:
Expand Down Expand Up @@ -114,6 +125,17 @@ steps:
event:
- tag

- name: docker-build
image: plugins/docker
settings:
dockerfile: package/Dockerfile
repo: "rancher/gke-operator"
tag: "${DRONE_COMMIT}-arm64"
dry_run: true
when:
event:
- pull_request

volumes:
- name: docker
host:
Expand Down
19 changes: 14 additions & 5 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
FROM golang:1.16
FROM registry.suse.com/suse/sle15:15.3

ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH
ENV ARCH=${DAPPER_HOST_ARCH}

RUN zypper -n update && \
zypper -n install bash git binutils glibc-devel-static gcc vim less file tar gzip curl sed wget ca-certificates

ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH_arm64=arm64 GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash
RUN curl -sLf https://storage.googleapis.com/golang/go1.16.4.linux-${ARCH}.tar.gz | tar -xzf - -C /usr/local/
# workaround for https://bugzilla.suse.com/show_bug.cgi?id=1183043
RUN if [ "${ARCH}" == "arm64" ]; then \
zypper -n install binutils-gold ; \
fi

RUN apt update && \
apt install -y bash git gcc docker.io vim less file curl wget ca-certificates
RUN if [ "${ARCH}" = "amd64" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0; \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.40.1; \
fi
RUN curl -sL https://get.helm.sh/helm-v3.3.0-linux-${ARCH}.tar.gz | tar xvzf - -C /usr/local/bin --strip-components=1

Expand Down
13 changes: 7 additions & 6 deletions package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG UBI_IMAGE=registry.access.redhat.com/ubi8/ubi-minimal:latest
FROM ${UBI_IMAGE}
ENV KUBECONFIG /root/.kube/config
RUN microdnf update -y && \
rm -rf /var/cache/yum
FROM registry.suse.com/suse/sle15:15.3
RUN zypper update -y && \
zypper -n clean -a && \
rm -rf /tmp/* /var/tmp/* /usr/share/doc/packages/*
RUN useradd --uid 1007 gke-operator
ENV KUBECONFIG /home/gke-operator/.kube/config
COPY bin/gke-operator /usr/bin/
USER 1001
USER 1007
ENTRYPOINT ["gke-operator"]
17 changes: 0 additions & 17 deletions scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@ source $(dirname $0)/version

cd $(dirname $0)/..

function build-image() {
IMAGE=${REPO}/${1}:${TAG}
DOCKERFILE=package/Dockerfile${2}
if [ -e ${DOCKERFILE}.${ARCH} ]; then
DOCKERFILE=${DOCKERFILE}.${ARCH}
fi

docker build -f ${DOCKERFILE} -t ${IMAGE} .
echo Built ${IMAGE}

if [ "$PUSH" = "true" ]; then
docker push ${IMAGE}
fi
}

mkdir -p dist/artifacts
cp bin/gke-operator dist/artifacts/gke-operator-linux${SUFFIX}
for i in bin/gke-operator-*; do
Expand All @@ -28,6 +13,4 @@ for i in bin/gke-operator-*; do
fi
done

build-image gke-operator

./scripts/package-helm

0 comments on commit c0f8cbe

Please sign in to comment.