GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Dockerfile.flux 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. FROM alpine:3.10
  2. WORKDIR /home/flux
  3. RUN apk add --no-cache openssh-client ca-certificates tini 'git>=2.12.0' 'gnutls>=3.6.7' gnupg gawk socat
  4. RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing git-secret
  5. # Add git hosts to known hosts file so we can use
  6. # StrickHostKeyChecking with git+ssh
  7. ADD ./known_hosts.sh /home/flux/known_hosts.sh
  8. RUN sh /home/flux/known_hosts.sh /etc/ssh/ssh_known_hosts && \
  9. rm /home/flux/known_hosts.sh
  10. # Add default SSH config, which points at the private key we'll mount
  11. COPY ./ssh_config /etc/ssh/ssh_config
  12. COPY ./kubectl /usr/local/bin/
  13. COPY ./kustomize /usr/local/bin
  14. # These are pretty static
  15. LABEL maintainer="Flux CD <https://github.com/fluxcd/flux/issues>" \
  16. org.opencontainers.image.title="flux" \
  17. org.opencontainers.image.description="The GitOps operator for Kubernetes" \
  18. org.opencontainers.image.url="https://github.com/fluxcd/flux" \
  19. org.opencontainers.image.source="git@github.com:fluxcd/flux" \
  20. org.opencontainers.image.vendor="Flux CD" \
  21. org.label-schema.schema-version="1.0" \
  22. org.label-schema.name="flux" \
  23. org.label-schema.description="The GitOps operator for Kubernetes" \
  24. org.label-schema.url="https://github.com/fluxcd/flux" \
  25. org.label-schema.vcs-url="git@github.com:fluxcd/flux" \
  26. org.label-schema.vendor="Flux CD"
  27. ENTRYPOINT [ "/sbin/tini", "--", "fluxd" ]
  28. # Get the kubeyaml binary (files) and put them on the path
  29. COPY --from=quay.io/squaremo/kubeyaml:0.7.0 /usr/lib/kubeyaml /usr/lib/kubeyaml/
  30. ENV PATH=/bin:/usr/bin:/usr/local/bin:/usr/lib/kubeyaml
  31. # Create minimal nsswitch.conf file to prioritize the usage of /etc/hosts over DNS queries.
  32. # This resolves the conflict between:
  33. # * fluxd using netgo for static compilation. netgo reads nsswitch.conf to mimic glibc,
  34. # defaulting to prioritize DNS queries over /etc/hosts if nsswitch.conf is missing:
  35. # https://github.com/golang/go/issues/22846
  36. # * Alpine not including a nsswitch.conf file. Since Alpine doesn't use glibc
  37. # (it uses musl), maintainers argue that the need of nsswitch.conf is a Go bug:
  38. # https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-354316460
  39. RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
  40. COPY ./kubeconfig /root/.kube/config
  41. COPY ./fluxd /usr/local/bin/
  42. ARG BUILD_DATE
  43. ARG VCS_REF
  44. # These will change for every build
  45. LABEL org.opencontainers.image.revision="$VCS_REF" \
  46. org.opencontainers.image.created="$BUILD_DATE" \
  47. org.label-schema.vcs-ref="$VCS_REF" \
  48. org.label-schema.build-date="$BUILD_DATE"