Skip to content

Commit

Permalink
Modify docker build files to work with new name (#13)
Browse files Browse the repository at this point in the history
* Modify docker build files to work with new name

* Add mkdir bin to makefile docker-build

Co-authored-by: Pavol Ipoth <pavol.ipoth@telekom.com>
  • Loading branch information
p53 and Pavol Ipoth committed Dec 14, 2020
1 parent 33fb815 commit 75c5423
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
26 changes: 13 additions & 13 deletions Dockerfile
Expand Up @@ -13,29 +13,29 @@ WORKDIR /src/
# commands to ensure any errors are caught.
RUN find . -name '*.tar.gz' -type f | xargs -rn1 tar -xzf
RUN if [ -f Makefile ]; then make; fi
RUN cp "$(find . -name 'louketo-proxy' -type f -print -quit)" /louketo-proxy
RUN cp "$(find . -name 'gatekeeper' -type f -print -quit)" /gatekeeper

#
# Actual image
#

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.2

LABEL Name=louketo-proxy \
Release=https://github.com/louketo/louketo-proxy \
Url=https://github.com/louketo/louketo-proxy \
Help=https://github.com/louketo/louketo-proxy/issues
LABEL Name=gatekeeper \
Release=https://github.com/go-gatekeeper/gatekeeper \
Url=https://github.com/go-gatekeeper/gatekeeper \
Help=https://github.com/go-gatekeeper/gatekeeper/issues

WORKDIR "/opt/louketo"
WORKDIR "/opt/gatekeeper"

RUN echo "louketo:x:1000:louketo" >> /etc/group && \
echo "louketo:x:1000:1000:louketo user:/opt/louketo:/sbin/nologin" >> /etc/passwd && \
chown -R louketo:louketo /opt/louketo && \
chmod -R g+rw /opt/louketo
RUN echo "gatekeeper:x:1000:gatekeeper" >> /etc/group && \
echo "gatekeeper:x:1000:1000:gatekeeper user:/opt/gatekeeper:/sbin/nologin" >> /etc/passwd && \
chown -R gatekeeper:gatekeeper /opt/gatekeeper && \
chmod -R g+rw /opt/gatekeeper

COPY templates ./templates
COPY --from=build-env /louketo-proxy ./
RUN chmod +x louketo-proxy
COPY --from=build-env /gatekeeper ./
RUN chmod +x gatekeeper

USER 1000
ENTRYPOINT [ "/opt/louketo/louketo-proxy" ]
ENTRYPOINT [ "/opt/gatekeeper/gatekeeper" ]
13 changes: 7 additions & 6 deletions Makefile
@@ -1,5 +1,5 @@
NAME=louketo-proxy
AUTHOR=louketo
NAME=gatekeeper
AUTHOR=go-gatekeeper
REGISTRY=docker.io
CONTAINER_TOOL=$(shell command -v podman 2>/dev/null || command -v docker)
ROOT_DIR=${PWD}
Expand Down Expand Up @@ -36,20 +36,21 @@ static: golang
container-build: docker-build
docker-build:
@echo "--> Compiling the project, inside a temporary container"
@mkdir -p bin
$(eval IMAGE=$(shell uuidgen))
${CONTAINER_TOOL} build --target build-env -t ${IMAGE} .
${CONTAINER_TOOL} run --rm ${IMAGE} /bin/cat /louketo-proxy > bin/louketo-proxy
${CONTAINER_TOOL} run --rm ${IMAGE} /bin/cat /gatekeeper > bin/gatekeeper
${CONTAINER_TOOL} rmi ${IMAGE}
chmod +x bin/louketo-proxy
chmod +x bin/gatekeeper

.PHONY: container-test docker-test
container-test: docker-test
docker-test:
@echo "--> Running the container image tests"
${CONTAINER_TOOL} run --rm -ti -p 3000:3000 \
-v ${ROOT_DIR}/config.yml:/etc/louketo/config.yml:ro \
-v ${ROOT_DIR}/config.yml:/etc/gatekeeper/config.yml:ro \
-v ${ROOT_DIR}/tests:/opt/tests:ro \
${REGISTRY}/${AUTHOR}/${NAME}:${VERSION} --config /etc/louketo/config.yml
${REGISTRY}/${AUTHOR}/${NAME}:${VERSION} --config /etc/gatekeeper/config.yml

.PHONY: container-release docker-release
container-release: docker-release
Expand Down

0 comments on commit 75c5423

Please sign in to comment.