7 Commits
0.1.1 ... 0.2.1

Author SHA1 Message Date
5616b2728d feat: Removes dotfiles from image in favor of having devpod set them up.
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m38s
2026-02-02 09:04:27 -05:00
b046127096 fix: Fixes image name typo in readme.
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
2026-02-01 16:34:06 -05:00
27337cd0e0 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
2026-02-01 16:24:14 -05:00
125209a99b feat: Adds swift backtrace build arg, defaults to disabling which currently prints a bunch of memory warnings.
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 13m54s
2025-12-01 13:12:05 -05:00
934598b6c7 fix: LSP doesn't work on slim variants, so remove those from ci builds.
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 4m32s
2025-11-12 14:37:02 -05:00
8cc12dfd2c feat: Test building with swift:slim, as a matrix strategy in ci.
All checks were successful
Create and publish a Docker image / build-and-push-image (latest) (push) Successful in 4m31s
Create and publish a Docker image / build-and-push-image (slim) (push) Successful in 3m10s
2025-11-12 14:17:20 -05:00
2286d8a63b feat: Test building with swift:slim, as a matrix strategy in ci.
Some checks failed
Create and publish a Docker image / build-and-push-image (latest) (push) Failing after 35s
Create and publish a Docker image / build-and-push-image (slim) (push) Failing after 35s
2025-11-12 14:16:01 -05:00
4 changed files with 68 additions and 48 deletions

View File

@@ -47,9 +47,7 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
type=raw,value=latest
- name: Build and push Docker image
id: push

View File

@@ -1,41 +1,52 @@
FROM docker.io/swift:latest 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 \
&& 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
######################################################
# 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 \
&& apt-get -q install -y \
curl \
git \
tree-sitter-cli \
wget \
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
WORKDIR /root/dev
# 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
VOLUME /root/dev
USER swift
CMD [ "/bin/bash", "-c", "/root/.local/share/bob/nvim-bin/nvim" ]

View File

@@ -1,38 +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-container: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.

View File

@@ -2,4 +2,7 @@ docker_image := "swift-dev"
docker_tag := "latest"
build:
@podman build -t {{docker_image}}:{{docker_tag}} .
@docker build -t {{docker_image}}:{{docker_tag}} .
run *ARGS:
@docker run -it --rm {{docker_image}}:{{docker_tag}} {{ARGS}}