Skip to content

Commit

Permalink
fix(dockerfile): corepack yarn during image build
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Dec 11, 2024
1 parent 609c502 commit 65d497b
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 6 deletions.
18 changes: 13 additions & 5 deletions charts/oada/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# vim: set ft=helm :
{{/*
* Copyright 2022 Open Ag Data Alliance
*
Expand Down Expand Up @@ -41,6 +42,10 @@ spec:
app.kubernetes.io/component: {{ $k }}
{{- include "oada.chart.selectorLabels" $ | nindent 8 }}
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
serviceAccountName: service-account-{{ $.Release.Name }}
initContainers:
- name: wait-for-init
Expand All @@ -51,6 +56,10 @@ spec:
resources:
limits: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
securityContext:
#runAsUser: 1000 # run as user node (uid 1000)
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
containers:
- envFrom:
- configMapRef:
Expand Down Expand Up @@ -88,14 +97,13 @@ spec:
port: prometheus
initialDelaySeconds: 10
periodSeconds: 10
securityContext:
runAsNonRoot: true
runAsUser: 1000 # run as user node (uid 1000)
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
name: {{ $name }}
resources:
{{- toYaml $.Values.oada.resources | nindent 12 }}
securityContext:
#runAsUser: 1000 # run as user node (uid 1000)
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
ports:
{{ if $v.http -}}
- name: http
Expand Down
22 changes: 22 additions & 0 deletions charts/oada/templates/init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ spec:
backoffLimit: 10
template:
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
restartPolicy: OnFailure
serviceAccountName: service-account-{{ .Release.Name }}
initContainers:
Expand All @@ -40,6 +44,9 @@ spec:
resources:
limits: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
{{- end }}
{{ if eq (include "oada.kafka.deploy" .) "true" -}}
- name: wait-for-redpanda
Expand All @@ -50,6 +57,9 @@ spec:
resources:
limits: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
{{- end }}
containers:
- name: init
Expand Down Expand Up @@ -83,4 +93,16 @@ spec:
resources:
limits: {{- toYaml $.Values.oada.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.oada.resources.limits | nindent 14 }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp
volumes:
- name: tmp
emptyDir:
sizeLimit: 1Gi
#medium: Memory
{{- end -}}
30 changes: 30 additions & 0 deletions charts/oada/templates/redpanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,36 @@ spec:
max: 10Gi
#ephemeral-storage: 1Gi
{{- end }}
statefulset:
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 1000739999
runAsGroup: 1000739999
fsGroup: 1000739999
podTemplate:
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 1000739999
runAsGroup: 1000739999
fsGroup: 1000739999
fsGroupChangePolicy: "OnRootMismatch"
console:
enabled: false
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
logging:
logLevel: info
usageStats:
Expand Down
17 changes: 17 additions & 0 deletions charts/oada/templates/users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ spec:
backoffLimit: 10
template:
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
restartPolicy: OnFailure
serviceAccountName: service-account-{{ $.Release.Name }}
initContainers:
Expand All @@ -58,6 +62,10 @@ spec:
resources:
limits: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
- name: wait-for-users
image: {{ $.Values.k8sWaitFor.image }}:{{ $.Values.k8sWaitFor.tag }}
args:
Expand All @@ -66,6 +74,9 @@ spec:
resources:
limits: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.k8sWaitFor.resources.limits | nindent 14 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
- name: user-add
envFrom:
- configMapRef:
Expand Down Expand Up @@ -110,6 +121,9 @@ spec:
resources:
limits: {{- toYaml $.Values.oada.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.oada.resources.limits | nindent 14 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
containers:
- name: token-create
envFrom:
Expand Down Expand Up @@ -153,6 +167,9 @@ spec:
resources:
limits: {{- toYaml $.Values.oada.resources.limits | nindent 14 }}
requests: {{- toYaml $.Values.oada.resources.limits | nindent 14 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
---
{{- end -}}
{{- end }}
4 changes: 3 additions & 1 deletion oada-server.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@
"typescript",
"javascript"
],
"commitPro.enableDefaultCommitlintRulesDiagnostics": false
"commitPro.enableDefaultCommitlintRulesDiagnostics": false,
"npm.packageManager": "yarn",
"cSpell.usePnP": true
}
}
3 changes: 3 additions & 0 deletions oada/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ WORKDIR /oada/services/${OADA_SERVICE}
USER node
ENV PORT=8080

# Have corepack download yarn
RUN corepack yarn;

FROM production as debug

USER root
Expand Down

0 comments on commit 65d497b

Please sign in to comment.