Files
swift-dev-container/Dockerfile
Michael Housh 27337cd0e0
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m40s
feat: Updates README to reflect updates for base image of a dev container.
2026-02-01 16:24:14 -05:00

60 lines
1.8 KiB
Docker

######################################################
# BUILD IMAGE
######################################################
FROM docker.io/swift:latest as build
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -q update \
&& apt-get -q dist-upgrade -y \
&& apt-get -q install -y \
cmake \
rustup \
&& rm -rf /var/lib/apt/lists/*
# Build and install starship, bob, and neovim.
RUN rustup default stable \
&& cargo install starship --locked \
&& cargo install --git https://github.com/MordechaiHadad/bob.git \
&& /root/.cargo/bin/bob install nightly \
&& /root/.cargo/bin/bob use nightly
######################################################
# RUN IMAGE
######################################################
FROM docker.io/swift:latest
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -q update \
&& apt-get -q dist-upgrade -y \
&& apt-get -q install -y \
curl \
direnv \
eza \
fzf \
ripgrep \
zsh \
&& rm -rf /var/lib/apt/lists/*
# Remove the ubuntu user, if it exists, so we can create the "swift" user.
RUN touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu || true
# Create the "swift" user
RUN groupadd --gid 1000 swift \
&& useradd -s /bin/zsh --uid 1000 --gid 1000 -m swift
# Copy dependencies from build image.
COPY --from=build /root/.cargo/bin/starship /usr/local/bin/starship
COPY --from=build /root/.cargo/bin/bob /home/swift/.local/bin/bob
COPY --from=build /root/.local/share/bob /home/swift/.local/share/bob
RUN chown -R swift:swift /home/swift/.local
USER swift
# Install dotfiles
RUN cd /home/swift \
&& git clone https://github.com/m-housh/dotfiles.git \
&& cd dotfiles \
&& git switch arch \
&& DEV_ENV=/home/swift/dotfiles ./devcontainer-env