Modify our Dockerfile to be like in gitpod/workspace

Source: https://github.com/gitpod-io/workspace-images/blob/master/base/Dockerfile
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-08-29 22:09:23 +08:00 committed by GitHub
parent 7e4554cf70
commit 8dab76f0fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 58 additions and 3 deletions

View File

@ -1,7 +1,62 @@
FROM ubuntu:20.04
# The main ubuntu image is so fucking large, DO NOT DO THAT AT HOME! Instead, we'll writing this Dockerfile
# based on https://github.com/gitpod-io/workspace-images/blob/master/base/Dockerfile, minus all the BS we don't
# really need in an real machine.
FROM buildpack-deps:focal
# Start our way out as root first
USER root
# TODO: Create an user with sudo prvilleges and with hardocded UID/GUID
RUN useradd gildedguy
# Reserved if you building from source
ARG DOCKER_UID=1000
# Copy our scripts to their destinations
COPY ../common/bin/logger.sh /usr/bin/entrypoint.sh
COPY ./bin/install-packages /usr/bin/install-packages
# Install deps in noninteractive mode.
ARG DEBIAN_FRONTEND=noninteractive
RUN yes | unminimize \
&& install-packages \
zip \
unzip \
bash-completion \
build-essential \
ninja-build \
htop \
jq \
less \
locales \
man-db \
nano \
ripgrep \
software-properties-common \
sudo \
time \
multitail \
lsof \
ssl-cert \
zsh \
&& locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
### Git ###
RUN add-apt-repository -y ppa:git-core/ppa \
&& install-packages git git-lfs
### Our dummy UNIX user, in which case, we're gonna use my usual Ubuntu user ###
# '-l': see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
RUN useradd -l -u $DOCKER_UID -G sudo -md /home/gildedguy -s /bin/bash -p gildedguy gildedguy \
# passwordless sudo for users in the 'sudo' group
&& sed -i.bkp -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
### Our dummy UNIX user, in which case, we're gonna use my usual Ubuntu user (2) ###
USER gildedguy
# use sudo so that we don't get sudo usage info on (the first) login
# also I misspelled Gildedguy's name for memes lol
RUN sudo echo "Running 'sudo' for Guildedguy: success
# configure git-lfs
RUN sudo git lfs install --system