Skip to content

Instantly share code, notes, and snippets.

@brunnels
Created January 19, 2019 17:21
Show Gist options
  • Save brunnels/678a41ea621c28321f6b54b34b7c4b8a to your computer and use it in GitHub Desktop.
Save brunnels/678a41ea621c28321f6b54b34b7c4b8a to your computer and use it in GitHub Desktop.
docker devenv container for digitial rebar provision
FROM phusion/baseimage:latest
ARG GO_SHA256=fb26c30e6a04ad937bbc657a1b5bba92f80096af1e8ee6da6430c045a8db3a5b
ENV GOLANG_VERSION=1.11.4 \
GOPATH=/root/go \
GOROOT=/usr/local/go
RUN apt-get update \
&& apt-get install -y build-essential git-core wget curl zip vim ca-certificates
RUN wget -O go.tgz --no-verbose https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz \
&& echo "${GO_SHA256} *go.tgz" | sha256sum -c - \
&& tar -C /usr/local -xzf go.tgz \
&& rm go.tgz
RUN mkdir -p $GOPATH/bin \
&& mkdir -p $GOPATH/pkg \
&& mkdir -p $GOPATH/src \
&& chmod -R 777 $GOPATH \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& export PATH=$PATH:$GOPATH/bin:$GOROOT/bin \
&& echo $GOLANG_VERSION > /etc/container_environment/GOLANG_VERSION \
&& echo $GOPATH > /etc/container_environment/GOPATH \
&& echo $GOROOT > /etc/container_environment/GOROOT \
&& echo "export PATH=\$PATH:$GOPATH/bin:$GOROOT/bin" > /etc/profile.d/zz_gopath.sh \
&& chmod +x /etc/profile.d/zz_gopath.sh \
&& go version
COPY id_rsa.pub /tmp/id_rsa.pub
RUN cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \
&& rm -f /tmp/id_rsa.pub \
&& rm -f /etc/service/sshd/down
EXPOSE 22/tcp
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
@brunnels
Copy link
Author

Just drop your id_rsa.pub key in the same folder as the Dockerfile before building.

Then follow the docs here

This works without error: curl -fsSL https://raw.githubusercontent.com/digitalrebar/provision/master/tools/build.sh | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment