1
+ FROM golang:1.17.5
2
+
3
+ # Avoid warnings by switching to noninteractive
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
7
+ # this user's GID/UID must match your local user UID/GID to avoid permission issues
8
+ # with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
9
+ # https://aka.ms/vscode-remote/containers/non-root-user for details.
10
+ ARG USERNAME=vscode
11
+ ARG USER_UID=1000
12
+ ARG USER_GID=$USER_UID
13
+
14
+ ENV GO111MODULE=auto
15
+
16
+ ENV GOLANGCI_LINT_V="v1.43.0"
17
+ ENV DOCKER_COMPOSE_V="1.29.2"
18
+
19
+ # Configure apt, install packages and tools
20
+ RUN apt-get update \
21
+ && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
22
+ #
23
+ # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
24
+ && apt-get -y install git iproute2 procps lsb-release \
25
+ #
26
+ # Install gocode-gomod
27
+ && go get -x -d github.com/stamblerre/gocode 2>&1 \
28
+ && go build -o gocode-gomod github.com/stamblerre/gocode \
29
+ && mv gocode-gomod $GOPATH/bin/ \
30
+ #
31
+ # Install Go tools
32
+ && go install golang.org/x/tools/
[email protected] \
33
+ && go install golang.org/x/tools/cmd/
[email protected] \
34
+ && go install golang.org/x/tools/cmd/
[email protected] \
35
+ && go install golang.org/x/tools/cmd/
[email protected] \
36
+ && go install github.com/uudashr/gopkgs/cmd/
[email protected] \
37
+ && go install github.com/ramya-rao-a/
[email protected] \
38
+ && go install github.com/godoctor/
[email protected] \
39
+ && go install github.com/rogpeppe/
[email protected] \
40
+ && go install github.com/zmb3/
[email protected] \
41
+ && go install github.com/sqs/
[email protected] \
42
+ && go install github.com/josharian/
[email protected] \
43
+ && go install github.com/davidrjenni/reftools/cmd/
[email protected] \
44
+ && go install github.com/fatih/
[email protected] \
45
+ && go install github.com/cweill/gotests/
[email protected] \
46
+ && go install github.com/golangci/golangci-lint/cmd/
[email protected] \
47
+ && go install honnef.co/go/tools/
[email protected] \
48
+ && go install github.com/mgechev/
[email protected] \
49
+ # Install golangci-lint
50
+ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_V} \
51
+ #
52
+ # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
53
+ && groupadd --gid $USER_GID $USERNAME \
54
+ && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
55
+ # [Optional] Add sudo support
56
+ && apt-get install -y sudo \
57
+ && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
58
+ && chmod 0440 /etc/sudoers.d/$USERNAME \
59
+ # Docker install
60
+ && apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common lsb-release \
61
+ && curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]' )/gpg | apt-key add - 2>/dev/null \
62
+ && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
63
+ && apt-get update \
64
+ && apt-get install -y docker-ce-cli \
65
+ # Docker-compose install
66
+ && curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_V}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
67
+ && chmod +x /usr/local/bin/docker-compose && ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose \
68
+ #
69
+ # Install pip & pre-commit
70
+ && apt-get -y install python3-pip \
71
+ && python3 -m pip install --no-cache-dir pre-commit \
72
+ #
73
+ # Clean up
74
+ && apt-get autoremove -y \
75
+ && apt-get clean -y \
76
+ && rm -rf /var/lib/apt/lists/*
77
+
78
+ # Copy private key for test-git-server
79
+ COPY test-git-server/private_keys/helm-repo-updater-test .
80
+
81
+ # Configure SSH adding helm-repo-updater-test key
82
+ RUN mkdir -p ~/.ssh
83
+ RUN chmod 600 ./helm-repo-updater-test
84
+
85
+ # Add git-server access with helm-repo-updater-test key to know_hosts
86
+ RUN echo "git-server $(ssh-keygen -f ./helm-repo-updater-test -y | cut -d' ' -f-2)" >> ~/.ssh/known_hosts
0 commit comments