-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (44 loc) · 2.1 KB
/
Dockerfile
File metadata and controls
53 lines (44 loc) · 2.1 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
# Multi-stage build for Azure CLI container with additional cloud tools
FROM alpine AS oc-builder
# Metadata for the builder stage
LABEL stage=builder
# Install OpenShift CLI in builder stage
ADD https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz /tmp/openshift-client-linux.tar.gz
RUN tar -xzf /tmp/openshift-client-linux.tar.gz -C /tmp/ && \
install -m 0755 /tmp/oc /usr/local/bin/oc && \
rm -rf /tmp/openshift-client-linux.tar.gz /tmp/README.md /tmp/kubectl
# Final stage based on Azure CLI
FROM mcr.microsoft.com/azure-cli:latest
# Metadata
LABEL maintainer="Cloudflight Managed Services Team"
LABEL description="Azure CLI container with additional cloud-native tools"
LABEL version="1.0.0"
LABEL org.opencontainers.image.source="https://git.internal.cloudflight.io/cloudflight/development-infrastructure/teamcity-build-images"
LABEL org.opencontainers.image.title="Azure CLI Build Container"
LABEL org.opencontainers.image.description="Container with Azure CLI, OpenShift CLI, Docker CLI, and kubectl"
LABEL org.opencontainers.image.vendor="Cloudflight"
# Copy OpenShift CLI from builder stage
COPY --from=oc-builder /usr/local/bin/oc /usr/local/bin/oc
# Install additional cloud tools using tdnf (Azure Linux package manager)
# Note: bash and curl are already available in the base Azure CLI image
RUN set -eux; \
tdnf install -y \
docker-cli \
kubectl && \
tdnf clean all && \
rm -rf /var/cache/tdnf/* /tmp/* /var/tmp/*
# Verify all tools are installed and create version info
RUN set -eux; \
{ \
echo "=== Azure CLI Container Tools ==="; \
echo "Azure CLI: $(az --version | head -1)"; \
echo "OpenShift CLI: $(oc version --client 2>/dev/null | head -1 || echo 'oc client version unavailable')"; \
echo "Docker CLI: $(docker --version)"; \
echo "Kubectl: $(kubectl version --client | head -1)"; \
echo "Build Date: $(date -u +"%Y-%m-%dT%H:%M:%SZ")"; \
} > /usr/local/share/tool-versions.txt && \
cat /usr/local/share/tool-versions.txt
# Set working directory
WORKDIR /workspace
# Default command
CMD ["/bin/bash"]