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

Commit 7513f59

Browse files
committed
Issue-609 Port over Gatekeeper's Dockerfile and kube YAMLs
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.
1 parent 48c72c0 commit 7513f59

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Builder image
3+
#
4+
5+
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.13 AS build-env
6+
ARG SOURCE=*
7+
8+
ADD $SOURCE /src/
9+
WORKDIR /src/
10+
11+
ENV GOFLAGS=''
12+
13+
# Try to execute a Makefile, but if the SOURCE url is just a tar of binaries,
14+
# then there probably won't be one. `|| true` makes us tolerant of that case.
15+
RUN find . -name '*.tar.gz' -type f | xargs -rn1 tar -xzf; \
16+
make || true; \
17+
cp "$(find . -name 'louketo-proxy' -type f -print -quit)" /louketo-proxy
18+
19+
#
20+
# Actual image
21+
#
22+
23+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
24+
25+
LABEL Name=louketo-proxy \
26+
Release=https://github.com/louketo/louketo-proxy \
27+
Url=https://github.com/louketo/louketo-proxy \
28+
Help=https://github.com/louketo/louketo-proxy/issues
29+
30+
WORKDIR "/opt/louketo"
31+
32+
RUN echo "louketo:x:1000:louketo" >> /etc/group && \
33+
echo "louketo:x:1000:1000:louketo user:/opt/louketo:/sbin/nologin" >> /etc/passwd && \
34+
chown -R louketo:louketo /opt/louketo && \
35+
chmod -R g+rw /opt/louketo
36+
37+
COPY --from=build-env /louketo-proxy ./
38+
39+
RUN microdnf update && \
40+
microdnf clean all && \
41+
chmod +x /opt/louketo/louketo-proxy
42+
43+
USER 1000
44+
45+
ENTRYPOINT [ "/opt/louketo/louketo-proxy" ]

kube/forward.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: proxy
5+
spec:
6+
replicas: 1
7+
template:
8+
metadata:
9+
labels:
10+
name: proxy
11+
annotations:
12+
repository: https://github.com/louketo/louketo-proxy
13+
spec:
14+
containers:
15+
- name: proxy
16+
image: docker.io/jboss/louketo/louketo-proxy:latest
17+
imagePullPolicy: Always
18+
args:
19+
- --config /etc/secrets/forwarding.yml
20+
- --discovery-url https://sso.example.com/auth/realms/hod-test
21+
- --client-id broker
22+
- --client-secret
23+
- --listen 127.0.0.1:3000
24+
- --enable-forwarding=true
25+
- --forwarding-username=username
26+
- --forwarding-password=password
27+
- --enable-logging=true
28+
- --enable-json-logging true
29+
- --verbose true
30+
volumeMounts:
31+
- name: secrets
32+
mountPath: /etc/secrets
33+
volumes:
34+
- name: secrets
35+
secret:
36+
secretName: config

kube/reverse.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: proxy
5+
spec:
6+
replicas: 1
7+
template:
8+
metadata:
9+
labels:
10+
name: proxy
11+
annotations:
12+
repository: https://github.com/louketo/louketo-proxy
13+
spec:
14+
securityContext:
15+
fsGroup: 1000
16+
runAsNonRoot: true
17+
runAsUser: 1000
18+
volumes:
19+
- name: certs
20+
secret:
21+
secretName: tls
22+
containers:
23+
- name: proxy
24+
image: docker.io/jboss/louketo/louketo-proxy:latest
25+
imagePullPolicy: Always
26+
args:
27+
- --client-id=broker
28+
- --discovery-url=https://sso.example.com/auth/realms/hod-test
29+
- --enable-default-deny=false
30+
- --enable-json-logging=true
31+
- --enable-logging=true
32+
- --enable-request-id=true
33+
- --enable-security-filter=true
34+
- --http-only-cookie=true
35+
- --listen=127.0.0.1:3000
36+
- --preserve-host=true
37+
- --redirection-url=https://www.example.com
38+
- --resources=uri=/admin/*|roles=admin
39+
- --skip-client-id=true
40+
- --tls-cert=/certs/tls.pem
41+
- --tls-private-key=/certs/tls-key.pem
42+
- --upstream-url=http://127.0.0.1:8080
43+
env:
44+
- name: PROXY_CLIENT_SECRET
45+
valueFrom:
46+
secretKeyRef:
47+
name: openid
48+
key: client.secret
49+
securityContext:
50+
readOnlyRootFilesystem: true
51+
volumeMounts:
52+
- name: certs
53+
mountPath: /certs
54+
readOnly: true

0 commit comments

Comments
 (0)