2019-07-13 14:43:45 -05:00
|
|
|
ARG slave_base_tag_ref=latest
|
2020-12-25 04:21:57 -06:00
|
|
|
{%- if CONFIGURED_ARCH == "amd64" %}
|
2019-11-21 18:14:32 -06:00
|
|
|
FROM sonic-slave-jessie:${slave_base_tag_ref}
|
2020-12-25 04:21:57 -06:00
|
|
|
{%- else %}
|
|
|
|
FROM sonic-slave-jessie-{{ CONFIGURED_ARCH }}:${slave_base_tag_ref}
|
|
|
|
{%- endif %}
|
2017-08-08 02:21:54 -05:00
|
|
|
|
|
|
|
# Add user
|
|
|
|
ARG user
|
|
|
|
ARG uid
|
|
|
|
ARG guid
|
|
|
|
ARG hostname
|
|
|
|
|
|
|
|
ENV BUILD_HOSTNAME $hostname
|
|
|
|
ENV USER $user
|
|
|
|
|
|
|
|
RUN groupadd -f -r -g $guid g$user
|
|
|
|
|
|
|
|
RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash
|
|
|
|
|
|
|
|
RUN gpasswd -a $user docker
|
|
|
|
|
|
|
|
# Config git for stg
|
|
|
|
RUN su $user -c "git config --global user.name $user"
|
|
|
|
RUN su $user -c "git config --global user.email $user@contoso.com"
|
|
|
|
|
|
|
|
COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2
|
|
|
|
RUN chown $user /var/$user/.ssh -R
|
|
|
|
RUN chmod go= /var/$user/.ssh -R
|
|
|
|
|
|
|
|
# Add user to sudoers
|
|
|
|
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
|
|
|
|
|
|
|
|
USER $user
|