Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching base image to ubi8-minimal #536

Merged
merged 4 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Dockerfile.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM ARG_FROM
ARG base_image=registry.access.redhat.com/ubi8/ubi-minimal:8.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we use this file anymore? Let's remove it if not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure... let me check.
make file is using package.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's part of goreleaser :(
nice catch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably need a way of auto get docker files for goreleaser

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do use Dockerfile.in in k10:

 636 docker_package_kanister() {
 637     local image_tag=${1:?"Image tag unspecified. Pick a tag that is unique for every code change."}
 638     pushd "${KANISTER_PATH}"
 639     cp ${BASE_DIR}/go/bin/controller controller
 640     GO111MODULE=on BIN=controller ARCH=amd64 BASEIMAGE=alpine \
 641         IMAGE=${DOCKER_ECR}/kanister VERSION=${image_tag}     \
 642         SOURCE_BIN=controller                                 \
 643         ./build/package.sh
 644     popd

FROM ${base_image}
MAINTAINER Tom Manville<tom@kasten.io>
ADD ARG_SOURCE_BIN /ARG_BIN
RUN apk -v --update add --no-cache ca-certificates && \
rm -f /var/cache/apk/*
RUN microdnf install git shadow-utils && \
microdnf clean all && \
adduser -U kanister

USER kanister
ADD --chown=kanister:kanister ARG_SOURCE_BIN /ARG_BIN
ENTRYPOINT ["/ARG_BIN"]
8 changes: 3 additions & 5 deletions build/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ if [ -z "${ARCH:-""}" ]; then
echo "ARCH must be set"
exit 1
fi
if [ -z "${BASEIMAGE:-""}" ]; then
echo "BASEIMAGE must be set"
exit 1
if [ -n "${BASEIMAGE:-""}" ]; then
baseimagearg="--build-arg base_image=${BASEIMAGE}"
fi
if [ -z "${IMAGE:-""}" ]; then
echo "IMAGE must be set"
Expand All @@ -48,8 +47,7 @@ fi
sed \
-e "s|ARG_BIN|${BIN}|g" \
-e "s|ARG_ARCH|${ARCH}|g" \
-e "s|ARG_FROM|${BASEIMAGE}|g" \
-e "s|ARG_SOURCE_BIN|${SOURCE_BIN}|g" \
Dockerfile.in > .dockerfile-${ARCH}
docker build -t ${IMAGE}:${VERSION} -f .dockerfile-${ARCH} .
docker build ${baseimagearg:-} -t ${IMAGE}:${VERSION} -f .dockerfile-${ARCH} .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build args make way more sense. I think this pattern was something I copied from Tim Hockins. Let's switch to build args completely in a followup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me ;)

docker images -q ${IMAGE}:${VERSION}
10 changes: 6 additions & 4 deletions docker/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM alpine:3.10
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
MAINTAINER Tom Manville<tom@kasten.io>
RUN apk -v --update add --no-cache ca-certificates && \
rm -f /var/cache/apk/*
ADD controller /controller
RUN microdnf install git shadow-utils && \
microdnf clean all && \
adduser -U kanister
USER kanister
ADD --chown=kanister:kanister controller /controller
ENTRYPOINT ["/controller"]
15 changes: 9 additions & 6 deletions docker/tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM alpine:3.10
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1

RUN apk -v --update add --no-cache bash curl groff less mailcap ca-certificates && \
rm -f /var/cache/apk/*
RUN microdnf install git shadow-utils && \
microdnf clean all && \
adduser -U kanister

COPY --from=restic/restic:0.9.5 /usr/bin/restic /usr/local/bin/restic
COPY --from=kanisterio/kopia:alpine-2fb6bc8 /kopia/kopia /usr/local/bin/kopia
ADD kando /usr/local/bin/
COPY --chown=kanister:kanister --from=restic/restic:0.9.5 /usr/bin/restic /usr/local/bin/restic
COPY --chown=kanister:kanister --from=kanisterio/kopia:alpine-2fb6bc8 /kopia/kopia /usr/local/bin/kopia
ADD --chown=kanister:kanister kando /usr/local/bin/

USER kanister

CMD [ "/usr/bin/tail", "-f", "/dev/null" ]