Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ARG BUILD_ARCH=x86_64
  2. FROM sapk/archlinux:$BUILD_ARCH AS builder_env
  3. LABEL maintainer="Jguer,joaogg3 at google mail"
  4. ENV GO111MODULE=on
  5. WORKDIR /app
  6. ADD ./testdata/ci/pacman.conf /etc/pacman.conf
  7. RUN pacman -Syu --overwrite=* --needed --noconfirm \
  8. gcc gnupg libldap go git tar make awk linux-api-headers pacman pacman-contrib && paccache -rfk0
  9. # Dependency for linting
  10. RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /bin v1.20.0
  11. RUN go get golang.org/x/lint/golint && mv /root/go/bin/golint /bin/
  12. ENV ARCH=$BUILD_ARCH
  13. COPY . .
  14. FROM builder_env AS builder
  15. # Change to include packages individually. Helps caching
  16. RUN make build
  17. FROM archlinux/base:latest
  18. RUN pacman -Syu --overwrite=* --needed --noconfirm \
  19. git base-devel awk pacman-contrib && paccache -rfk0
  20. # Gracefully removed from https://github.com/Cognexa/dockerfiles/blob/master/dockerfiles/archlinux
  21. RUN useradd -m -s /bin/bash aur && \
  22. passwd -d aur && \
  23. echo 'aur ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/aur && \
  24. echo 'Defaults env_keep += "EDITOR"' >>/etc/sudoers.d/aur
  25. ENV EDITOR vim
  26. # set UTF-8 locale
  27. RUN echo 'en_US.UTF-8 UTF-8' >/etc/locale.gen && locale-gen
  28. ENV LANG en_US.UTF-8
  29. WORKDIR /work/
  30. COPY --from=builder /app/yay .