feat: Updates README to reflect updates for base image of a dev container.
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m40s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m40s
This commit is contained in:
69
Dockerfile
69
Dockerfile
@@ -1,46 +1,59 @@
|
||||
ARG SWIFT_VERSION="swift:latest"
|
||||
ARG SWIFT_BACKTRACE="enable=no"
|
||||
|
||||
FROM docker.io/${SWIFT_VERSION} AS build
|
||||
######################################################
|
||||
# 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 install -y \
|
||||
cmake \
|
||||
rustup \
|
||||
&& apt-get -q install -y \
|
||||
cmake \
|
||||
rustup \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN rustup default stable && \
|
||||
cargo install --git https://github.com/MordechaiHadad/bob.git && \
|
||||
/root/.cargo/bin/bob install nightly && \
|
||||
/root/.cargo/bin/bob use nightly
|
||||
# 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
|
||||
|
||||
FROM docker.io/${SWIFT_VERSION}
|
||||
######################################################
|
||||
# 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 install -y \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
tree-sitter-cli \
|
||||
wget \
|
||||
&& apt-get -q install -y \
|
||||
curl \
|
||||
direnv \
|
||||
eza \
|
||||
fzf \
|
||||
ripgrep \
|
||||
zsh \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build /root/.cargo/bin/bob /root/bin/bob
|
||||
COPY --from=build /root/.local/share/bob /root/.local/share/bob
|
||||
# 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
|
||||
|
||||
RUN cat >> /root/.bashrc <<EOF
|
||||
PATH="/root/bin:/root/.local/share/bob/nvim-bin:$PATH"
|
||||
alias n='nvim'
|
||||
EOF
|
||||
# Create the "swift" user
|
||||
RUN groupadd --gid 1000 swift \
|
||||
&& useradd -s /bin/zsh --uid 1000 --gid 1000 -m swift
|
||||
|
||||
ENV SWIFT_BACKTRACE=${SWIFT_BACKTRACE}
|
||||
# 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
|
||||
|
||||
WORKDIR /root/dev
|
||||
USER swift
|
||||
|
||||
VOLUME /root/dev
|
||||
# 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
|
||||
|
||||
CMD [ "/bin/bash", "-c", "/root/.local/share/bob/nvim-bin/nvim" ]
|
||||
|
||||
50
README.md
50
README.md
@@ -1,34 +1,46 @@
|
||||
# Swift development container
|
||||
|
||||
A development container built off swift / ubuntu as base image. This is needed because I currently can not get swift to
|
||||
install on arch linux, so this is used to develop inside a docker container.
|
||||
A development container built off swift / ubuntu as base image. This is typically
|
||||
used as a base image for a `devcontainer` for for a swift project.
|
||||
|
||||
## Extra Packages
|
||||
|
||||
## Installed Packages
|
||||
|
||||
This image includes my relevant dotfiles (shell, neovim, scripts, etc.) and the
|
||||
following extra packages:
|
||||
|
||||
- bob (neovim version manager)
|
||||
- cmake
|
||||
- curl
|
||||
- git
|
||||
- direnv
|
||||
- eza
|
||||
- fzf
|
||||
- neovim (nightly)
|
||||
- tree-sitter-cli
|
||||
- wget
|
||||
- ripgrep
|
||||
- starship
|
||||
- zsh
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
podman run -it --name "$(basename "$PWD")" \
|
||||
-v "$HOME/.config/nvim":/root/.config/nvim \
|
||||
-v "$HOME/.local/share/nvim":/root/.local/share/nvim \
|
||||
-v "$PWD":/root/dev \
|
||||
-w /root/dev \
|
||||
git.housh.dev/michael/swift-dev-container:latest
|
||||
In a new project, use this image as the base image for your dev container.
|
||||
|
||||
**.devcontainer/devcontainer.json**
|
||||
```json
|
||||
{
|
||||
"name": "Swift",
|
||||
"image": "git.housh.dev/swift-dev:latest",
|
||||
"features": {
|
||||
...
|
||||
},
|
||||
...
|
||||
"remoteUser": "swift"
|
||||
}
|
||||
```
|
||||
|
||||
### Notes
|
||||
### Start the dev container.
|
||||
|
||||
The default command will open neovim in the `/root/dev` folder.
|
||||
```bash
|
||||
devpod up . --ide=none
|
||||
|
||||
```
|
||||
|
||||
The above runs a container and names it so that it can be restarted in the future to continue working on a project.
|
||||
|
||||
The `-w | --workdir` is not required if you mount your project to the `/root/dev` folder, as that is the default
|
||||
declared by the container, it is shown here for clarity.
|
||||
|
||||
Reference in New Issue
Block a user