Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Issue-609 Port over Gatekeeper's Dockerfile and kube YAMLs
Browse files Browse the repository at this point in the history
I ended up rewriting a good portion of the Dockerfile. It now uses a
multi-stage build. It can accept source code to build, or unpack a premade
binary.
  • Loading branch information
ASzc committed Jun 10, 2020
1 parent 48c72c0 commit fd41f6e
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Builder image
#

FROM golang:1.14.4 AS build-env
ARG SOURCE=*

ADD $SOURCE /src/
WORKDIR /src/

ENV GOFLAGS=''

# Unpack any tars, then try to execute a Makefile, but if the SOURCE url is
# just a tar of binaries, then there probably won't be one. Using multiple RUN
# commands to ensure any errors are caught.
RUN find . -name '*.tar.gz' -type f | xargs -rn1 tar -xzf
RUN [ -f Makefile ] && make static
RUN cp "$(find . -name 'louketo-proxy' -type f -print -quit)" /louketo-proxy

#
# Actual image
#

FROM alpine:latest

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

WORKDIR "/opt/louketo"

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

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

USER 1000
ENTRYPOINT [ "/opt/louketo/louketo-proxy" ]
36 changes: 36 additions & 0 deletions kube/forward.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: proxy
spec:
replicas: 1
template:
metadata:
labels:
name: proxy
annotations:
repository: https://github.com/louketo/louketo-proxy
spec:
containers:
- name: proxy
image: docker.io/jboss/louketo/louketo-proxy:latest
imagePullPolicy: Always
args:
- --config /etc/secrets/forwarding.yml
- --discovery-url https://sso.example.com/auth/realms/hod-test
- --client-id broker
- --client-secret
- --listen 127.0.0.1:3000
- --enable-forwarding=true
- --forwarding-username=username
- --forwarding-password=password
- --enable-logging=true
- --enable-json-logging true
- --verbose true
volumeMounts:
- name: secrets
mountPath: /etc/secrets
volumes:
- name: secrets
secret:
secretName: config
54 changes: 54 additions & 0 deletions kube/reverse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: proxy
spec:
replicas: 1
template:
metadata:
labels:
name: proxy
annotations:
repository: https://github.com/louketo/louketo-proxy
spec:
securityContext:
fsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
volumes:
- name: certs
secret:
secretName: tls
containers:
- name: proxy
image: docker.io/jboss/louketo/louketo-proxy:latest
imagePullPolicy: Always
args:
- --client-id=broker
- --discovery-url=https://sso.example.com/auth/realms/hod-test
- --enable-default-deny=false
- --enable-json-logging=true
- --enable-logging=true
- --enable-request-id=true
- --enable-security-filter=true
- --http-only-cookie=true
- --listen=127.0.0.1:3000
- --preserve-host=true
- --redirection-url=https://www.example.com
- --resources=uri=/admin/*|roles=admin
- --skip-client-id=true
- --tls-cert=/certs/tls.pem
- --tls-private-key=/certs/tls-key.pem
- --upstream-url=http://127.0.0.1:8080
env:
- name: PROXY_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: openid
key: client.secret
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- name: certs
mountPath: /certs
readOnly: true

0 comments on commit fd41f6e

Please sign in to comment.