Skip to content

Commit

Permalink
added Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalan committed Jan 28, 2024
1 parent 90c6b05 commit 5797503
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
26 changes: 24 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,28 @@ RUN apt update && \
# Install CS50 library
RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | bash && \
apt update && \
apt install --yes libcs50
apt install libcs50
# Install Docker
# https://docs.docker.com/engine/install/ubuntu/
# https://docs.docker.com/engine/install/linux-postinstall/
RUN apt update && \
apt install --no-install-recommends --no-install-suggests --yes \
ca-certificates \
curl && \
install -d /etc/apt/keyrings -m 0755 && \
curl --fail --location --show-error --silent https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt update && \
sudo apt install --no-install-recommends --no-install-suggests --yes \
containerd.io \
docker-buildx-plugin \
docker-ce \
docker-ce-cli \
docker-compose-plugin && \
groupadd --force docker
# Install Python packages
Expand Down Expand Up @@ -260,7 +281,8 @@ RUN useradd --home-dir /home/ubuntu --shell /bin/bash ubuntu && \
echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
echo "Defaults umask_override" >> /etc/sudoers && \
echo "Defaults umask=0022" >> /etc/sudoers && \
sed --expression="s/^Defaults\tsecure_path=.*/Defaults\t!secure_path/" --in-place /etc/sudoers
sed --expression="s/^Defaults\tsecure_path=.*/Defaults\t!secure_path/" --in-place /etc/sudoers && \
usermod --append --groups docker ubuntu
# Version the image (and any descendants)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rebuild:
$(MAKE) squash

run:
docker run --env LANG="$(LANG)" --interactive --publish-all --rm --security-opt seccomp=unconfined --tty --volume "$(PWD)":/home/ubuntu cs50/cli bash --login || true
docker run --env LANG="$(LANG)" --interactive --privileged --publish-all --rm --security-opt seccomp=unconfined --tty --volume "$(PWD)":/home/ubuntu cs50/cli bash --login || true

squash: depends
docker images cs50/cli
Expand Down

0 comments on commit 5797503

Please sign in to comment.