Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cubesystems/nginx-gomplate
Gomplate support for nginx-unprivileged docker image
https://github.com/cubesystems/nginx-gomplate
Last synced: 27 days ago
JSON representation
Gomplate support for nginx-unprivileged docker image
- Host: GitHub
- URL: https://github.com/cubesystems/nginx-gomplate
- Owner: cubesystems
- Created: 2023-12-21T16:00:05.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-21T16:19:26.000Z (about 1 year ago)
- Last Synced: 2024-11-07T23:42:56.927Z (3 months ago)
- Language: Shell
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gomplate support for nginx-unprivileged docker image
Add-on script to add `gomplate` template engine support to nginx-unprivileged Docker image
## Example dockerfile
Here's an example Dockerfile that demonstrates how to add Gomplate support to the nginx-unprivileged image:```
FROM nginxinc/nginx-unprivileged:alpineUSER root
RUN apk add --no-cache gomplate && \
curl https://raw.githubusercontent.com/cubesystems/nginx-gomplate/master/21-gomplate-on-templates.sh \
-o /docker-entrypoint.d/21-gomplate-on-templates.sh && \
chmod a+x /docker-entrypoint.d/21-gomplate-on-templates.shUSER nginx
# Copy your custom template files with .gomplate prefix (Ex. docker/nginx-templates/default.conf.gomplate to replace default vhost)
COPY docker/nginx-templates/ /etc/nginx/templates/
```## Sample Helm template for nginx deployment
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
minReadySeconds: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: {{ .Release.Name }}
tier: nginx
template:
metadata:
name: nginx
labels:
app: {{ .Release.Name }}
tier: nginx
appVersion: {{ .Values.appVersion | quote }}
spec:
containers:
- name: nginx
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 101 # nginx uid
runAsGroup: 101 # nginx gid
{{- if .Values.deployments.nginx.envFrom }}
envFrom: {{- toYaml .Values.deployments.nginx.envFrom | nindent 12 }}
{{- end }}
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /ping
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
volumeMounts:
- mountPath: /tmp
name: tmp
- mountPath: /etc/nginx/conf.d
name: nginx-conf
imagePullSecrets:
- name: {{ .Values.image.registrySecretName }}
volumes:
- name: tmp
emptyDir: {}
- name: nginx-conf
emptyDir: {}```