Files
kubesphere/build/ks-controller-manager/Dockerfile
hongzhouzi ade0d324da Upgrade go version to 1.19 (#5446)
Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
2023-01-12 16:48:34 +08:00

53 lines
1.2 KiB
Docker

# Copyright 2020 The KubeSphere Authors. All rights reserved.
# Use of this source code is governed by an Apache license
# that can be found in the LICENSE file.
# Download dependencies
FROM alpine:3.16.2 as base_os_context
ARG INGRESS_NGINX_VERSION=4.0.13
ENV OUTDIR=/out
RUN mkdir -p ${OUTDIR}/var/helm-charts
WORKDIR /tmp
RUN apk add --no-cache ca-certificates
# Install Nginx Ingress Helm Chart
ADD https://github.com/kubernetes/ingress-nginx/releases/download/helm-chart-${INGRESS_NGINX_VERSION}/ingress-nginx-${INGRESS_NGINX_VERSION}.tgz /tmp
RUN tar xvzf /tmp/ingress-nginx-${INGRESS_NGINX_VERSION}.tgz -C /tmp
RUN mv /tmp/ingress-nginx ${OUTDIR}/var/helm-charts/
# Build
FROM golang:1.19.4 as build_context
ENV OUTDIR=/out
RUN mkdir -p ${OUTDIR}/usr/local/bin/
RUN mkdir -p ${OUTDIR}/var/helm-charts
WORKDIR /workspace
ADD . /workspace/
RUN make ks-controller-manager
RUN mv /workspace/bin/cmd/controller-manager ${OUTDIR}/usr/local/bin/
# Copy gateway config and helm chart
RUN mv /workspace/config/gateway ${OUTDIR}/var/helm-charts/
RUN mv /workspace/config/watches.yaml ${OUTDIR}/var/helm-charts/
# Final Image
FROM alpine:3.16.2
COPY --from=base_os_context /out/ /
COPY --from=build_context /out/ /
WORKDIR /
EXPOSE 8443 8080
CMD ["sh"]