Skip to content

Commit

Permalink
Merge pull request #9 from pgier/multi-stage-docker-build
Browse files Browse the repository at this point in the history
update Dockerfile to use multi-stage build
  • Loading branch information
openshift-merge-robot authored Dec 18, 2018
2 parents bb85bd3 + 494ff32 commit 3c2f857
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
FROM openshift/origin-base
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.10 AS builder
WORKDIR /go/src/github.com/jimmidyson/configmap-reload
COPY . .
RUN make out/configmap-reload

ENV GOPATH /go
RUN mkdir -p $GOPATH/bin

COPY . $GOPATH/src/github.com/jimmidyson/configmap-reload

RUN yum install -y golang make git && \
cd $GOPATH/src/github.com/jimmidyson/configmap-reload && \
PATH=$PATH:$GOPATH/bin make out/configmap-reload GOPATH=$GOPATH && cp $GOPATH/src/github.com/jimmidyson/configmap-reload/out/configmap-reload /usr/bin/configmap-reload && \
yum autoremove -y golang make git && yum clean all

LABEL io.k8s.display-name="configmap reload" \
FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:base
LABEL io.k8s.display-name="OpenShift ConfigMap Reload" \
io.k8s.description="This is a component reloads another process if a configured configmap volume is remounted." \
io.openshift.tags="kubernetes" \
maintainer="Frederic Branczyk <[email protected]>"

# doesn't require a root user.
USER 1001
ARG FROM_DIRECTORY=/go/src/github.com/jimmidyson/configmap-reload
COPY --from=builder ${FROM_DIRECTORY}/out/configmap-reload /usr/bin/configmap-reload

USER nobody

ENTRYPOINT ["/usr/bin/configmap-reload"]

0 comments on commit 3c2f857

Please sign in to comment.