Install golang from tar
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2021-02-02 15:42:48 -08:00
parent 904f16c777
commit e82b8757c2
4 changed files with 27 additions and 7 deletions

View File

@ -1,14 +1,13 @@
ARG BASE_IMAGE=iamthefij/drone-pre-commit ARG BASE_IMAGE=iamthefij/drone-pre-commit
FROM ${BASE_IMAGE}:base FROM ${BASE_IMAGE}:base
RUN apt-get update && \
apt-get install -y --no-install-recommends golang=2:1.11~1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Add helper scripts # Add helper scripts
COPY ./scripts /scripts COPY ./scripts /scripts
# Bundle hadolint # Add golang
RUN /scripts/add_golang.sh
ENV PATH=$PATH:/usr/local/go/bin
# Add some other linters
RUN /scripts/add_hadolint.sh RUN /scripts/add_hadolint.sh
RUN /scripts/add_golangci_lint.sh RUN /scripts/add_golangci_lint.sh

20
scripts/add_golang.sh Executable file
View File

@ -0,0 +1,20 @@
#! /bin/bash
set -ex
VERSION=1.15.7
SHASUM=0d142143794721bb63ce6c8a6180c4062bcf8ef4715e7d6d6609f3a8282629b3
FILENAME=go${VERSION}.linux-amd64.tar.gz
GOURL=https://golang.org/dl/${FILENAME}
wget --quiet "$GOURL"
# Check sum
echo "$SHASUM ./$FILENAME" > "${FILENAME}.sum"
shasum -c "./${FILENAME}.sum"
# Install
tar -C /usr/local -xzf "./$FILENAME"
# Clean up
rm "$FILENAME" "${FILENAME}.sum"

View File

@ -1,4 +1,5 @@
#! /bin/bash #! /bin/bash
set -ex
VERSION=v1.35.2 VERSION=v1.35.2

View File

@ -2,5 +2,5 @@
set -ex set -ex
VERSION=v1.18.0 VERSION=v1.18.0
wget -L -O /usr/bin/hadolint "https://github.com/hadolint/hadolint/releases/download/${VERSION}/hadolint-Linux-x86_64" wget -q -L -O /usr/bin/hadolint "https://github.com/hadolint/hadolint/releases/download/${VERSION}/hadolint-Linux-x86_64"
chmod +x /usr/bin/hadolint chmod +x /usr/bin/hadolint