Last active
March 1, 2018 07:24
-
-
Save avshabanov/dc634f4d5fb78170de50c51a264db94c to your computer and use it in GitHub Desktop.
CentOS docker image for Go development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build environment image | |
# Do the following to build and run: | |
# docker build -t bld-centos-7 . | |
# Once image is built, you can run it: | |
# docker run -it bld-centos-7 /bin/bash | |
# The same, but with mounted 'proj' folder: | |
# docker run -it --mount type=bind,source="$(pwd)"/proj,target=/proj bld-centos-7 /bin/bash | |
# The same, also initializes systemd and maps gopath's src into /goproj/src: | |
# docker run -d -e=container=docker --stop-signal=SIGRTMIN+3 --cap-add=SYS_ADMIN --security-opt=seccomp:unconfined -v /sys/fs/cgroup:/sys/fs/cgroup:ro --mount type=bind,source=$GOPATH/src,target=/goproj/src bld-centos-7 /sbin/init | |
FROM centos:7 | |
RUN echo "Install build environment software..." | |
RUN yum install -y screen tcpdump make | |
# RPM development | |
RUN yum install -y rpmdevtools rpm-build | |
RUN yum clean all | |
# Install Go 1.10 | |
RUN curl -s https://dl.google.com/go/go1.10.linux-amd64.tar.gz > /go1.10.linux-amd64.tar.gz | |
RUN tar xfz /go1.10.linux-amd64.tar.gz | |
RUN mv /go /opt/go | |
RUN rm /go1.10.linux-amd64.tar.gz | |
# Set go dir | |
ENV GOROOT /opt/go | |
RUN mkdir /goproj | |
ENV GOPATH /goproj | |
# Set up system-wide PATH variables in the global profile | |
RUN echo 'export PATH=$PATH:/opt/go/bin' > /etc/profile.d/go.sh | |
RUN echo "Installation completed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment