The old system with vendor/ and git submodules worked great, unfortunately FUD around git submodules seemed to scare people away and golang moved to a go.mod system that adds a new lock file format instead of using the built-in git version. It's now almost impossible to use modern golang without this, so we've switched. So much for the golang compatibility promise-- turns out it doesn't apply to the useful parts that I actually care about like this. Thanks to frebib for his incredibly valuable contributions to this patch. This snide commit message is mine alone. This patch also mixes in some changes due to legacy golang as we've also bumped the minimum version to 1.16 in the docs and tests. Lastly, we had to disable some tests and fix up a few other misc things to get this passing. We've definitely hot bugs in the go.mod system, and our Makefile tries to workaround those.
32 lines
851 B
Docker
32 lines
851 B
Docker
FROM golang:1.16
|
|
|
|
MAINTAINER Michał Czeraszkiewicz <contact@czerasz.com>
|
|
|
|
# Set the reset cache variable
|
|
# Read more here: http://czerasz.com/2014/11/13/docker-tip-and-tricks/#use-refreshedat-variable-for-better-cache-control
|
|
ENV REFRESHED_AT 2019-02-06
|
|
|
|
RUN apt-get update
|
|
|
|
# Setup User to match Host User
|
|
# Give the nre user superuser permissions
|
|
ARG USER_ID=1000
|
|
ARG GROUP_ID=1000
|
|
ARG USER_NAME=mgmt
|
|
ARG GROUP_NAME=$USER_NAME
|
|
RUN groupadd --gid $GROUP_ID $GROUP_NAME && \
|
|
useradd --create-home --home /home/$USER_NAME --uid ${USER_ID} --gid $GROUP_NAME --groups sudo $USER_NAME && \
|
|
echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
|
|
# Copy all the files to the working directory
|
|
COPY . /home/$USER_NAME/mgmt
|
|
|
|
# Change working directory
|
|
WORKDIR /home/$USER_NAME/mgmt
|
|
|
|
# Install dependencies
|
|
RUN make deps
|
|
|
|
# Change user
|
|
USER ${USER_NAME}
|