Skip to content

Commit

Permalink
S-96287 Detached installation of the Release and RRR (#217)
Browse files Browse the repository at this point in the history
Co-authored-by: Vedran Pugar <vedran.pugar@digital.ai>
  • Loading branch information
vpugar-digital and Vedran Pugar authored Mar 6, 2024
1 parent 4069a97 commit c1d45df
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
1 change: 0 additions & 1 deletion applejack/conf/products/xl-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ dockerfiles:
alpine: xl-cli/Dockerfile.j2
repositories:
nexus: 'https://nexus.xebialabs.com/nexus/service/local/repositories/{repo}/content/com/xebialabs/xlclient/xl-client/{version}/{product}-{version}-linux-amd64.bin'
# Todo proper DIST URL
dist: 'https://dist.xebialabs.com/public/xl-cli/{version}/linux-amd64/xl'
resources:
target_name: '{product}-{version}-linux-amd64.bin'
Expand Down
51 changes: 31 additions & 20 deletions templates/dockerfiles/xl-cli/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM alpine:3.16 as installer
FROM alpine:3.19 as installer

# Install dependencies
RUN apk update
RUN apk add --no-cache gawk unzip curl busybox-extras

ENV USER_UID=10001 APP_ROOT=/opt/xebialabs
ENV APP_HOME=${APP_ROOT}/{{ product }}
ENV XL_OP_BLUEPRINTS_HOME=${APP_ROOT}/xl-op-blueprints

COPY resources/{{ product }}-{{ xl_version }}-linux-amd64.bin /tmp

Expand All @@ -15,7 +16,13 @@ RUN mkdir -p ${APP_HOME} && \
chmod -R g=u ${APP_ROOT} && \
chmod +x ${APP_HOME}/xl

FROM alpine:3.16
RUN mkdir -p ${XL_OP_BLUEPRINTS_HOME} && \
wget -O /tmp/xl-op-blueprints-{{ xl_version }}.zip https://nexus.xebialabs.com/nexus/content/repositories/digitalai-public/ai/digital/xlclient/blueprints/xl-op-blueprints/{{ xl_version }}/xl-op-blueprints-{{ xl_version }}.zip && \
unzip -o /tmp/xl-op-blueprints-{{ xl_version }}.zip -d ${XL_OP_BLUEPRINTS_HOME} && \
chgrp -R 0 ${XL_OP_BLUEPRINTS_HOME} && \
chmod -R g=u ${XL_OP_BLUEPRINTS_HOME}

FROM alpine:3.19

{% include 'metadata.j2' %}

Expand Down Expand Up @@ -53,6 +60,8 @@ RUN apk add --no-cache curl tar && \
# Install vim
RUN apk add --no-cache vim xclip

{% if xl_version.endswith('-all') %}

# Install oc
RUN apk add --no-cache gcompat curl ca-certificates tar gzip && \
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.8.11/openshift-client-linux.tar.gz | tar zx && \
Expand Down Expand Up @@ -83,19 +92,33 @@ RUN apk update && \
RUN pip3 install awscli
RUN aws --version

# Set up gcloud config, aws config
RUN mkdir -p ${APP_ROOT}/.config/gcloud && \
mkdir -p ${APP_ROOT}/.aws

# Install Krew
RUN cd /tmp \
&& wget -O krew-linux_amd64.tar.gz https://github.com/kubernetes-sigs/krew/releases/download/v0.4.3/krew-linux_amd64.tar.gz \
&& tar zxvf krew-linux_amd64.tar.gz \
&& ./krew-linux_amd64 install krew && \
rm -rf /tmp/krew*

# Set up Krew
ENV PATH="${APP_ROOT}/.krew/bin:${PATH}"

RUN kubectl krew install oidc-login

{% endif %}

# Add user
RUN apk add --no-cache shadow && \
useradd -d /opt/xebialabs -m -r -u 10001 -g 0 xebialabs

# Copy installed {{ product_name }}
COPY --from=installer ${APP_ROOT} ${APP_ROOT}

# Set up gcloud config, aws config and kube config folder
RUN mkdir -p ${APP_ROOT}/.config/gcloud && \
mkdir -p ${APP_ROOT}/.kube && \
mkdir -p ${APP_ROOT}/.aws

ENV KUBECONFIG=${APP_ROOT}/.kube/config
# Set up kube config folder
RUN mkdir -p ${APP_ROOT}/.kube

# Install Tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static ${APP_ROOT}/tini
Expand All @@ -107,16 +130,4 @@ WORKDIR ${APP_HOME}
# Don't run as root
USER 10001

# Install Krew
RUN cd /tmp \
&& wget -O krew-linux_amd64.tar.gz https://github.com/kubernetes-sigs/krew/releases/download/v0.4.3/krew-linux_amd64.tar.gz \
&& tar zxvf krew-linux_amd64.tar.gz \
&& ./krew-linux_amd64 install krew && \
rm -rf /tmp/krew*

# Set up Krew
ENV PATH="${APP_ROOT}/.krew/bin:${PATH}"

RUN kubectl krew install oidc-login

ENTRYPOINT ["/opt/xebialabs/tini", "--", "/opt/xebialabs/xl-client/xl"]

0 comments on commit c1d45df

Please sign in to comment.