FROM docker:dind

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN apk add --no-cache \
    curl \
    bash \
    build-base \
    openssl-dev \
 && addgroup -g ${USER_GID} ${USERNAME} \
 && adduser -D -u ${USER_UID} -G ${USERNAME} -s /bin/bash ${USERNAME} \
 && addgroup ${USERNAME} docker

USER ${USERNAME}
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

USER root
CMD ["/usr/local/bin/dockerd-entrypoint.sh"]
