Last active
August 6, 2020 17:04
-
-
Save attawayinc/104b00d8f924ce289f527288dcc0052c to your computer and use it in GitHub Desktop.
Installations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Docker_CE_CLI and Docker Compose | |
RUN apt-get update \ | |
# | |
# Install Docker CE CLI | |
&& apt-get install -y apt-transport-https ca-certificates curl gnupg2 lsb-release \ | |
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \ | |
&& echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \ | |
&& apt-get update \ | |
&& apt-get install -y docker-ce-cli \ | |
# | |
# Install Docker Compose | |
&& export LATEST_COMPOSE_VERSION=$(curl -sSL "https://api.github.com/repos/docker/compose/releases/latest" | grep -o -P '(?<="tag_name": ").+(?=")') \ | |
&& curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \ | |
&& chmod +x /usr/local/bin/docker-compose | |
ARG USERNAME=user-name-goes-here | |
ARG USER_UID=1000 | |
ARG USER_GID=$USER_UID | |
# Create the user | |
RUN groupadd --gid $USER_GID $USERNAME \ | |
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | |
# | |
# [Optional] Add sudo support. Omit if you don't need to install software after connecting. | |
&& apt-get update \ | |
&& apt-get install -y sudo \ | |
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | |
&& chmod 0440 /etc/sudoers.d/$USERNAME | |
# ******************************************************** | |
# * Anything else you want to do like clean up goes here * | |
# ******************************************************** | |
# [Optional] Set the default user. Omit if you want to keep the default as root. | |
USER $USERNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment