Skip to content

Instantly share code, notes, and snippets.

@dbehnke
Last active November 10, 2016 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbehnke/ff10a3e723c8f28113e64996743bfb76 to your computer and use it in GitHub Desktop.
Save dbehnke/ff10a3e723c8f28113e64996743bfb76 to your computer and use it in GitHub Desktop.
Go Compiling from Centos6 - useful for if you have cgo and need to compile things from oldest Linux possible
FROM centos:6
RUN yum -y update && \
yum -y install curl gcc gcc-c++ libaio-devel git && \
yum clean all && \
rm -r -f /var/cache/yum/*
COPY getgo.sh /opt/
RUN cd /opt && chmod +x ./getgo.sh && ./getgo.sh && mkdir /usr/local/go
RUN groupadd -g 1000 somebody && useradd -m -u 1000 -g 1000 somebody && chown -R somebody:somebody /usr/local/go
ENV GOROOT=/opt/go
ENV GOPATH=/usr/local/go
ENV PATH=/opt/go/bin:/usr/local/go/bin:$PATH
#!/bin/bash
baseurl="https://storage.googleapis.com/golang/"
curl https://golang.org/dl/ -o index.html && \
dlfile=$(cat index.html | grep "linux-amd64" | grep "download downloadBox" | head -n 1 | awk -F/ '{ print $5 }' | awk -F'"' '{ print $1 }') && \
echo dlfile=${dlfile}
curl -vL ${baseurl}${dlfile} -o ${dlfile} && \
tar xvfz ${dlfile} && \
rm *.tar.gz index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment