diff --git a/.gitignore b/.gitignore index d38c149..36f5023 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.swp *~ +.env diff --git a/Dockerfile b/Dockerfile index bfc65f5..8fb4cd0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,23 @@ FROM ubuntu:focal LABEL Description="This image is used to learn building dockerfiles" \ Author="david@socialnerds.org" \ - Version="0.1" \ + Version="rolling" \ License="MIT" ENV USER_ID=1000 ENV GROUP_ID=1000 +ENV USERNAME=david +ENV TIMEZONE=Europe/Vienna -VOLUME [ "/mnt" ] +VOLUME [ "/home/${USERNAME}" ] -RUN apt-get update && apt-get upgrade -y && \ - groupadd -g $GROUP_ID container-dev && \ - useradd -u $USER_ID -g $GROUP_ID -M -d /mnt -s /bin/false container-dev +RUN apt-get update && apt-get upgrade -y && apt-get install -y sudo vim git zsh curl wget iproute2 dnsutils && \ + groupadd -g ${GROUP_ID} ${USERNAME} && \ + useradd -u ${USER_ID} -g ${GROUP_ID} -M -d /home/${USERNAME} -s /bin/zsh ${USERNAME} && \ + echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ + ln -fs /usr/share/zoneinfo/${TIMEZONE} /etc/localtime -USER container-dev +USER $USERNAME +WORKDIR /home/$USERNAME CMD top -b diff --git a/README.md b/README.md index 10b0417..d4a11cc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ # jekyll-dev Simple container to learn building Dockerfiles. - diff --git a/docker-compose.yml b/docker-compose.yml index f41572f..4fa843d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,6 @@ services: image: container-dev:latest build: . container_name: container-dev - environment: - - USER_ID=1000 - - GROUP_ID=1000 + volumes: + - /home/david:/home/david + restart: unless-stopped