I have a Dockerfile with the following content:
FROM ubuntu:bionic as builder
ARG DIGITALOCEAN_ACCESS_TOKEN
ARG K8S_CLUSTER
ARG ARGO_SERVER
ARG ARGO_USERNAME
ARG ARGO_PW
RUN apt-get update
RUN apt-get install -y curl
#WORKDIR /app
RUN curl -L https://github.com/digitalocean/doctl/releases/download/v1.41.0/doctl-1.41.0-linux-amd64.tar.gz | tar xz
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
RUN curl -L https://github.com/argoproj/argo-cd/releases/download/v1.4.3/argocd-linux-amd64 -o argocd
RUN chmod +x ./argocd
RUN chmod +x ./kubectl
RUN mv ./argocd /usr/local/bin/
RUN mv ./kubectl /usr/local/bin/
RUN mv ./doctl /usr/local/bin/
CMD doctl auth init -t ${DIGITALOCEAN_ACCESS_TOKEN}; \
doctl kubernetes cluster kubeconfig save ${K8S_CLUSTER}; \
kubectl get svc; \
argocd login ${ARGO_SERVER} --username ${ARGO_USERNAME} --password ${ARGO_PW} --grpc-web; \
argocd context; \
argocd repo list;
ENTRYPOINT ["/usr/local/bin/argocd"]
Running the container:
docker run --rm -it \
--env=DIGITALOCEAN_ACCESS_TOKEN=c24a7f963ba86e1d38aff12 \
--env=K8S_CLUSTER=k8s \
--env=ARGO_SERVER=argocd.pod.io \
--env=ARGO_USERNAME=user \
--env=ARGO_PW=password \
--name argocd \
argo-cli repo list
it shows:
FATA[0000] Argo CD server address unspecified
the connection to server should get established through the commands:
CMD doctl auth init -t ${DIGITALOCEAN_ACCESS_TOKEN}; \
doctl kubernetes cluster kubeconfig save ${K8S_CLUSTER}; \
kubectl get svc; \
argocd login ${ARGO_SERVER} --username ${ARGO_USERNAME} --password ${ARGO_PW} --grpc-web; \
argocd context; \
argocd repo list;
What I am trying to achieve is, when I pass the argument, like I did it above with argo-cli repo list
, then the connection to the server should be already established to get the result.