coder-templates/docker-golang/build/Dockerfile

24 lines
525 B
Docker

FROM ubuntu
RUN apt-get update \
&& apt-get install -y \
curl \
git \
golang \
sudo \
vim \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz \
&& rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
ARG USER=coder
RUN useradd --groups sudo --shell /bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
USER ${USER}
WORKDIR /home/${USER}