dev-container/base/Dockerfile
James Harton f8db5949a3
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing
chore: add Elixir container.
2023-08-25 09:23:02 +12:00

71 lines
2.4 KiB
Docker

FROM ubuntu:latest
ENV DEBIAN_FRONTEND="noninteractive"
# Install basic dependencies
RUN apt-get -q -y update && \
apt-get -q -y --no-install-recommends install autoconf automake \
bash build-essential bzip2 ca-certificates curl dpkg-dev file \
g++ gcc git-core imagemagick libbz2-dev libc6-dev libdb-dev libevent-dev \
libffi-dev libgdbm-dev libglib2.0-dev libgmp-dev libjpeg-dev libkrb5-dev \
liblzma-dev libmagickcore-dev libmagickwand-dev libmaxminddb-dev \
libncurses-dev libncurses5-dev libncursesw5-dev libpng-dev libpq-dev \
libreadline-dev libsctp-dev libsqlite3-dev libssl-dev libtool libwebp-dev \
libxml2-dev libxslt-dev libyaml-dev locales make make mercurial patch python3 \
unixodbc-dev unzip wget xz-utils zlib1g-dev zsh gnupg inotify-tools less \
postgresql-client ssh direnv && apt-get -q -y clean
ARG LOCALE=en_NZ
RUN locale-gen $LOCALE.UTF-8
ENV LANG $LOCALE.UTF-8
ENV LANGUAGE $LOCALE:en
ENV LC_ALL $LOCALE.UTF-8
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid ${USER_GID} ${USERNAME}
RUN useradd --shell /usr/bin/zsh --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME}
RUN mkdir /workspace && chown ${USERNAME}:${USERNAME} /workspace
RUN touch /entrypoint.sh && chown ${USERNAME}:${USERNAME} /entrypoint.sh
RUN mkdir -p /var/tmp/history && chown -R ${USERNAME}:${USERNAME} /var/tmp/history
RUN mkdir /storage && chown ${USERNAME}:${USERNAME} /storage
# Install starship.
RUN curl -sS https://starship.rs/install.sh > install.sh
RUN chmod 755 install.sh
RUN ./install.sh --yes
RUN rm install.sh
COPY asdf /usr/local/bin/
RUN chmod 755 /usr/local/bin/asdf
COPY asdf_install /usr/local/bin/
RUN chmod 755 /usr/local/bin/asdf_install
USER ${USERNAME}
ENV HOME=/home/${USERNAME}
ENV PATH=/usr/local/bin:${PATH}
WORKDIR $HOME
# Install ASDF
ARG ASDF_VERSION=0.10.2
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v${ASDF_VERSION}
# Install dotfiles.
RUN mkdir -p $HOME/.config
RUN curl -sS https://code.harton.nz/james/.config/raw/branch/main/starship.toml > $HOME/.config/starship.toml
RUN curl -sS https://code.harton.nz/james/.config/raw/branch/main/zshrc > $HOME/.zshrc
WORKDIR /workspace/
# Generate an entrypoint.sh
RUN echo '#!/bin/bash' > /entrypoint.sh && \
echo 'source ~/.asdf/asdf.sh' >> /entrypoint.sh && \
echo 'eval "$(direnv hook bash)"' >> /entrypoint.sh && \
echo 'exec "$@"' >> /entrypoint.sh && \
chmod 755 /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["zsh"]