Skip to content

Patch the backstage project to support docker build using dind-rootless image #21

@cmoulliard

Description

@cmoulliard

To do

Refactor the bash install script to patch the backstage project in order to support to build the docs using the Mkdocs python tool to:

  • Have a new container running dind-rootless
  • Configure the techdocs.generator and specifiy the image of mkdocs to be used
docker pull docker:dind-rootless 
docker tag docker:dind-rootless  registry.harbor.10.0.77.176.nip.io:32443/tap/dind-rootless
docker push registry.harbor.10.0.77.176.nip.io:32443/tap/dind-rootless

k patch pkgi tap -n tap-install -p '{"spec":{"paused":true}}' --type=merge
k patch pkgi tap-gui -n tap-install -p '{"spec":{"paused":true}}' --type=merge

TEMP_DIR="$HOME/tmp"
cat <<EOF > $TEMP_DIR/tap-gui-dind-patch.yaml
spec:
  template:
    spec:
      containers:
      - command:
        - dockerd      
        - --host
        - tcp://127.0.0.1:2375
        image: registry.harbor.10.0.77.176.nip.io:32443/tap/dind-rootless
        imagePullPolicy: IfNotPresent
        name: dind-daemon
        resources: {}
        securityContext:
          privileged: true
          runAsUser: 0
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /tmp
          name: tmp
        - mountPath: /output
          name: output
      - name: backstage
        env:
        - name: DOCKER_HOST
          value: tcp://localhost:2375
        volumeMounts:
        - mountPath: /tmp
          name: tmp
        - mountPath: /output
          name: output
      volumes:
      - emptyDir: {}
        name: tmp
      - emptyDir: {}
        name: output
EOF

k get secret -n tap-gui app-config-ver-1 -o json | jq -r '.data."app-config.yaml"' | base64 -d > $TEMP_DIR/tap-gui-secret.yaml
cat <<EOF >> $TEMP_DIR/tap-gui-secret.yaml
techdocs:
  generator:
    dockerImage: ghcr.io/vrabbi/techdocs:v1.0.3
EOF

CM_CONTENT=`cat $TEMP_DIR/tap-gui-secret.yaml | base64 -w 0`
cat << EOF > $TEMP_DIR/tap-gui-secret-patch.yaml
data:
  app-config.yaml: $CM_CONTENT
EOF

k patch secret -n tap-gui app-config-ver-1 --patch-file $TEMP_DIR/tap-gui-secret-patch.yaml
k patch deploy server -n tap-gui --patch-file $TEMP_DIR/tap-gui-dind-patch.yaml
k rollout status deployment server -n tap-gui

Thanks to vrabbi: https://github.com/vrabbi/local-tap-setup/blob/master/local-tap.sh#L685 :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions