2019-09-26 10:45:48 +00:00
|
|
|
ARG BUILD_ARCH=x86_64
|
|
|
|
FROM sapk/archlinux:$BUILD_ARCH AS builder_env
|
|
|
|
LABEL maintainer="Jguer,joaogg3 at google mail"
|
|
|
|
|
|
|
|
ENV GO111MODULE=on
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN pacman -Syu --overwrite=* --needed --noconfirm \
|
2019-10-22 09:32:14 +00:00
|
|
|
gcc gnupg libldap go git tar make awk linux-api-headers pacman pacman-contrib && paccache -rfk0
|
2019-09-26 10:45:48 +00:00
|
|
|
|
|
|
|
# Dependency for linting
|
2019-10-22 09:32:14 +00:00
|
|
|
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /bin v1.20.0
|
2019-10-13 19:10:46 +00:00
|
|
|
RUN go get golang.org/x/lint/golint && mv /root/go/bin/golint /bin/
|
2019-09-26 10:45:48 +00:00
|
|
|
|
|
|
|
ENV ARCH=$BUILD_ARCH
|
2019-10-22 09:32:14 +00:00
|
|
|
COPY . .
|
2019-09-26 10:45:48 +00:00
|
|
|
|
|
|
|
FROM builder_env AS builder
|
|
|
|
|
|
|
|
# Change to include packages individually. Helps caching
|
|
|
|
RUN make build
|
|
|
|
|
|
|
|
FROM archlinux/base:latest
|
|
|
|
|
|
|
|
RUN pacman -Syu --overwrite=* --needed --noconfirm \
|
|
|
|
git base-devel awk pacman-contrib && paccache -rfk0
|
|
|
|
|
|
|
|
# Gracefully removed from https://github.com/Cognexa/dockerfiles/blob/master/dockerfiles/archlinux
|
2019-10-22 09:32:14 +00:00
|
|
|
RUN useradd -m -s /bin/bash aur && \
|
|
|
|
passwd -d aur && \
|
|
|
|
echo 'aur ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/aur && \
|
|
|
|
echo 'Defaults env_keep += "EDITOR"' >>/etc/sudoers.d/aur
|
2019-09-26 10:45:48 +00:00
|
|
|
|
|
|
|
ENV EDITOR vim
|
|
|
|
|
|
|
|
# set UTF-8 locale
|
2019-10-22 09:32:14 +00:00
|
|
|
RUN echo 'en_US.UTF-8 UTF-8' >/etc/locale.gen && locale-gen
|
2019-09-26 10:45:48 +00:00
|
|
|
ENV LANG en_US.UTF-8
|
|
|
|
|
|
|
|
WORKDIR /work/
|
|
|
|
|
|
|
|
COPY --from=builder /app/yay .
|