Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
KEYCLOAK-12054 Use multi-stage builds
Browse files Browse the repository at this point in the history
  • Loading branch information
slaskawi committed Nov 26, 2019
1 parent 5eea69c commit 25d5e56
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 64 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ tmp
# HTML file from test coverage
*.html

# Temporary Build Files
build/_output
build/_test

# Temporary e2e Test Files
deploy/empty-init.yaml

Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest AS build-env

RUN microdnf install -y git make golang

ADD ./ /src
RUN cd /src && make code/compile
RUN cd /src && echo "Build SHA1: $(git rev-parse HEAD)"
RUN cd /src && echo "$(git rev-parse HEAD)" > /src/BUILD_INFO

# final stage
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

ENV OPERATOR=/usr/local/bin/keycloak-operator \
USER_UID=1001 \
USER_NAME=keycloak-operator

RUN microdnf update && microdnf clean all && rm -rf /var/cache/yum/*

COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup

COPY --from=build-env /src/BUILD_INFO /src/BUILD_INFO
COPY --from=build-env /src/tmp/_output/bin/keycloak-operator /usr/local/bin

ENTRYPOINT ["/usr/local/bin/entrypoint"]

USER ${USER_UID}
31 changes: 0 additions & 31 deletions build/Dockerfile

This file was deleted.

1 change: 1 addition & 0 deletions build/Dockerfile
29 changes: 0 additions & 29 deletions build/tools/build-operator.sh

This file was deleted.

0 comments on commit 25d5e56

Please sign in to comment.