This repository was archived by the owner on Jul 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (60 loc) · 2.5 KB
/
Copy pathDockerfile
File metadata and controls
74 lines (60 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Multi-stage build for tools
FROM registry.redhat.io/openshift4/ose-tools-rhel9@sha256:1538eacbd3708f44ea4cb90bcda2cb45696f46fb53716b87fc2e86fdcc167cc7 AS ose-tools
# Builder stage for ArgoCD CLI
FROM registry.access.redhat.com/ubi9/ubi:9.7-1771346757 AS builder
# Install ArgoCD CLI
RUN VERSION=$(curl -L -s https://raw.githubusercontent.com/argoproj/argo-cd/stable/VERSION) \
&& curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/download/v$VERSION/argocd-linux-amd64 \
&& install -m 555 argocd-linux-amd64 /usr/local/bin/argocd \
&& rm argocd-linux-amd64 \
&& argocd version --client
# Install yq
ARG YQ_VERSION=4.47.1
RUN curl --proto "=https" --tlsv1.2 -sSf -L "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64" -o /usr/local/bin/yq \
&& chmod +x /usr/local/bin/yq \
&& yq --version
# Final stage
FROM registry.access.redhat.com/ubi9/nodejs-20:9.7-1771417935
LABEL name="tssc-test" \
maintainers="TSSC Team"
WORKDIR /tssc-test
# Switch to root
USER 0
# Copy tools from ose-tools stage
COPY --from=ose-tools /usr/bin/jq /usr/bin/kubectl /usr/bin/oc /usr/bin/vi /usr/bin/
# Copy required libraries for jq
COPY --from=ose-tools /usr/lib64/libjq.so.1 /usr/lib64/libonig.so.5 /usr/lib64/
# Copy vi libraries
COPY --from=ose-tools /usr/libexec/vi /usr/libexec/
# Copy ArgoCD CLI from builder stage
COPY --from=builder /usr/local/bin/argocd /usr/local/bin/argocd
# Copy yq from builder stage
COPY --from=builder /usr/local/bin/yq /usr/local/bin/yq
# Verify tools installation (fail fast if tools are broken)
RUN echo "=== Verifying tool installations ===" && \
jq --version && \
yq --version && \
kubectl version --client && \
oc version --client && \
argocd version --client && \
echo "=== All tools verified successfully ==="
# Copy application source code
COPY . .
# Install npm packages, system dependencies, and Playwright browsers
RUN npm install && \
npm cache clean --force && \
yum install -y --allowerasing \
wget \
nss at-spi2-atk libdrm gtk3 mesa-libgbm alsa-lib \
libXcomposite libXcursor libXdamage libXext libXi \
libXrandr libXScrnSaver libXtst pango atk cairo-gobject \
gdk-pixbuf2 \
&& yum clean all && \
npx playwright install chromium
# Change ownership of all files to the final user
RUN chown -R 1001:0 /tssc-test
# Switch to the non-root user
USER 1001
# Set environment variables for the running application
ENV KUBECONFIG=/tssc-test/.kube/config \
NPM_CONFIG_CACHE=/tmp/.npm