2019-03-14 11:45:49 +00:00
|
|
|
# Dockerfile for building nomad binaries
|
|
|
|
# that mimics Vagrant environment as far as required
|
|
|
|
# for building the scripts and running provision scripts
|
|
|
|
|
2020-12-08 14:55:53 +00:00
|
|
|
FROM ubuntu:18.04
|
2019-03-14 11:45:49 +00:00
|
|
|
|
|
|
|
RUN apt-get update; apt-get install -y \
|
|
|
|
apt-transport-https \
|
|
|
|
ca-certificates \
|
|
|
|
curl \
|
|
|
|
git \
|
|
|
|
sudo \
|
|
|
|
tree \
|
|
|
|
unzip \
|
|
|
|
wget
|
|
|
|
|
|
|
|
RUN useradd --create-home vagrant \
|
|
|
|
&& echo 'vagrant ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|
|
|
|
|
|
|
# install priv packages
|
2019-03-15 15:02:52 +00:00
|
|
|
COPY ./scripts/vagrant-linux-priv-config.sh /tmp/scripts/vagrant-linux-priv-config.sh
|
2019-03-14 11:45:49 +00:00
|
|
|
RUN /tmp/scripts/vagrant-linux-priv-config.sh
|
|
|
|
|
2019-03-15 15:02:52 +00:00
|
|
|
COPY ./scripts/vagrant-linux-priv-go.sh /tmp/scripts/vagrant-linux-priv-go.sh
|
2019-03-14 11:45:49 +00:00
|
|
|
RUN /tmp/scripts/vagrant-linux-priv-go.sh
|
|
|
|
|
2020-11-17 15:01:48 +00:00
|
|
|
COPY ./scripts/vagrant-linux-priv-buf.sh /tmp/scripts/vagrant-linux-priv-buf.sh
|
|
|
|
RUN /tmp/scripts/vagrant-linux-priv-buf.sh
|
2019-03-14 11:45:49 +00:00
|
|
|
|
|
|
|
USER vagrant
|
|
|
|
|
2019-03-15 15:02:52 +00:00
|
|
|
COPY ./scripts/vagrant-linux-unpriv-ui.sh /tmp/scripts/vagrant-linux-unpriv-ui.sh
|
2019-03-14 11:45:49 +00:00
|
|
|
RUN /tmp/scripts/vagrant-linux-unpriv-ui.sh
|
2020-11-13 16:33:07 +00:00
|
|
|
# avoid requiring loading nvm.sh by using a well defined path as an alias to the node version
|
|
|
|
RUN /bin/bash -c '. ~/.nvm/nvm.sh && ln -s ~/.nvm/versions/node/$(nvm current) ~/.nvm/versions/node/.default'
|
2019-03-14 11:45:49 +00:00
|
|
|
|
2019-03-15 15:02:52 +00:00
|
|
|
COPY ./scripts/release/docker-build-all /tmp/scripts/docker-build-all
|
|
|
|
|
2019-03-14 11:45:49 +00:00
|
|
|
# Update PATH with GO bin, yarn, and node
|
|
|
|
ENV GOPATH="/opt/gopath" \
|
2020-11-13 16:33:07 +00:00
|
|
|
PATH="/home/vagrant/.nvm/versions/node/.default/bin:/home/vagrant/bin:/opt/gopath/bin:/home/vagrant/.yarn/bin:/home/vagrant/.config/yarn/global/node_modules/.bin:$PATH"
|
2019-03-14 11:45:49 +00:00
|
|
|
|
|
|
|
RUN mkdir -p /opt/gopath/src/github.com/hashicorp/nomad
|
|
|
|
RUN mkdir -p /home/vagrant/bin \
|
2021-07-29 03:33:59 +00:00
|
|
|
&& mkdir -p /home/vagrant/bin /home/vagrant/.ssh \
|
2019-03-14 11:45:49 +00:00
|
|
|
&& git config --global user.email "nomad@hashicorp.com" \
|
|
|
|
&& git config --global user.name "Nomad Release Bot"
|
2021-07-29 03:33:59 +00:00
|
|
|
|
|
|
|
## Prepare vagrant user for private github.com deps fetching
|
|
|
|
RUN git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
|
|
|
|
RUN echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' > /home/vagrant/.ssh/known_hosts
|
|
|
|
|
|
|
|
ARG SSH_KEY
|
|
|
|
RUN echo "$SSH_KEY" > /home/vagrant/.ssh/id_rsa \
|
|
|
|
&& chmod 600 /home/vagrant/.ssh/id_rsa
|