Skip to content

Commit 8a206f0

Browse files
author
Georg Martin Weber
committed
no root image
1 parent 5081247 commit 8a206f0

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

azure-pipelines.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,25 @@ jobs:
5757
dockerRegistryConnection: '${{ parameters.DockerRegistryEndpoint }}'
5858
action: 'Push an image'
5959
imageName: 'hull/hull-integration:$(HULL_VSADDON_VERSION)'
60-
60+
61+
- task: Docker@0
62+
displayName: 'Docker Build noroot'
63+
inputs:
64+
containerregistrytype: 'Container Registry'
65+
dockerRegistryConnection: '${{ parameters.DockerRegistryEndpoint }}'
66+
dockerFile: './images/hull-integration/Dockerfile-noroot'
67+
defaultContext: false
68+
context: './images/hull-integration'
69+
imageName: 'hull/hull-integration:$(HULL_VSADDON_VERSION)-noroot'
70+
71+
- task: Docker@0
72+
displayName: 'Docker Push'
73+
inputs:
74+
containerregistrytype: 'Container Registry'
75+
dockerRegistryConnection: '${{ parameters.DockerRegistryEndpoint }}'
76+
action: 'Push an image'
77+
imageName: 'hull/hull-integration:$(HULL_VSADDON_VERSION)-noroot'
78+
6179
- script: |
6280
CHART_RELEASER_VERSION=1.5.0
6381
set -euo pipefail

hull-vidispine-addon/templates/_library.tpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,15 @@ rabbitmq-connectionString:
500500
{{ $endpointApplication := include "hull.vidispine.addon.library.get.endpoint.application" (dict "PARENT_CONTEXT" $parent "ENDPOINT" $databaseKey) }}
501501
serviceAccountName: {{ $serviceAccountName }}
502502
restartPolicy: {{ default "Never" (index . "RESTART_POLICY") }}
503+
securityContext:
504+
runAsNonRoot: true
505+
runAsUser: 1001
503506
initContainers:
504507
{{ if $createScriptConfigMap }}
505508
copy-custom-scripts:
506509
image:
507510
repository: {{ dig "images" "dbTools" "repository" "vpms/dbtools" $parent.Values.hull.config.specific }}
508-
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "1.9-1" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
511+
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "2.0-noroot" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
509512
args:
510513
- "/bin/sh"
511514
- "-c"
@@ -520,7 +523,7 @@ initContainers:
520523
set-custom-script-permissions:
521524
image:
522525
repository: {{ dig "images" "dbTools" "repository" "vpms/dbtools" $parent.Values.hull.config.specific }}
523-
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "1.9-1" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
526+
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "2.0-noroot" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
524527
args:
525528
- "/bin/sh"
526529
- "-c"
@@ -533,7 +536,7 @@ initContainers:
533536
check-database-ready:
534537
image:
535538
repository: {{ dig "images" "dbTools" "repository" "vpms/dbtools" $parent.Values.hull.config.specific }}
536-
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "1.9-1" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
539+
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "2.0-noroot" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
537540
env:
538541
DBHOST:
539542
value: {{ $databaseHost }}
@@ -603,7 +606,7 @@ containers:
603606
{{ end }}
604607
image:
605608
repository: {{ dig "images" "dbTools" "repository" "vpms/dbtools" $parent.Values.hull.config.specific }}
606-
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "1.9-1" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
609+
tag: {{ (dig "images" "dbTools" "tag" (dig "tags" "dbTools" "2.0-noroot" $parent.Values.hull.config.specific) $parent.Values.hull.config.specific) | toString | quote }}
607610
env:
608611
DBHOST:
609612
value: {{ $databaseHost }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM mcr.microsoft.com/powershell:7.3-ubuntu-22.04
2+
RUN pwsh -NonInteractive -Command Install-Module -Force -Scope AllUsers powershell-yaml
3+
RUN apt-get update
4+
RUN apt-get -y install curl
5+
ENV VERSION="1.1.0"
6+
RUN curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
7+
RUN ls
8+
RUN mkdir -p oras-install/
9+
RUN tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
10+
RUN mv oras-install/oras /usr/local/bin/
11+
RUN rm -rf oras_${VERSION}_*.tar.gz oras-install/
12+
# Create a user group 'noroot'
13+
RUN groupadd noroot
14+
# Add a user noroot to group 'noroot'
15+
RUN useradd --create-home --shell /bin/bash -u 1001 -g noroot noroot
16+
COPY ./Installer.ps1 /script/Installer.ps1
17+
RUN chown -R noroot /script
18+
COPY ./get-custom-scripts /get-custom-scripts
19+
RUN chown -R noroot /get-custom-scripts
20+
RUN oras --help

0 commit comments

Comments
 (0)