Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5616b2728d
|
|||
|
b046127096
|
|||
|
27337cd0e0
|
|||
|
125209a99b
|
|||
|
934598b6c7
|
|||
|
8cc12dfd2c
|
|||
|
2286d8a63b
|
|||
|
ed7ae83a9d
|
@@ -1,6 +1,6 @@
|
|||||||
name: Create and publish a Docker image
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
# Configures this workflow to run every time a change is pushed to the main branch with a semvar tag.
|
# Configures this workflow to run every time a change is pushed to the main branch with a semver tag.
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
@@ -47,9 +47,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=semver,pattern={{version}}
|
||||||
type=semvar,pattern={{version}}
|
|
||||||
type=sha
|
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: push
|
id: push
|
||||||
|
|||||||
51
Dockerfile
51
Dockerfile
@@ -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 \
|
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||||
&& apt-get -q update \
|
&& apt-get -q update \
|
||||||
&& apt-get -q dist-upgrade -y \
|
&& apt-get -q dist-upgrade -y \
|
||||||
&& apt-get install -y \
|
&& apt-get -q install -y \
|
||||||
cmake \
|
cmake \
|
||||||
rustup \
|
rustup \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN rustup default stable && \
|
# Build and install starship, bob, and neovim.
|
||||||
cargo install --git https://github.com/MordechaiHadad/bob.git && \
|
RUN rustup default stable \
|
||||||
/root/.cargo/bin/bob install nightly && \
|
&& cargo install starship --locked \
|
||||||
/root/.cargo/bin/bob use nightly
|
&& 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
|
FROM docker.io/swift:latest
|
||||||
|
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||||
&& apt-get -q update \
|
&& apt-get -q update \
|
||||||
&& apt-get -q dist-upgrade -y \
|
&& apt-get -q dist-upgrade -y \
|
||||||
&& apt-get install -y \
|
&& apt-get -q install -y \
|
||||||
cmake \
|
|
||||||
curl \
|
curl \
|
||||||
git \
|
direnv \
|
||||||
tree-sitter-cli \
|
eza \
|
||||||
wget \
|
fzf \
|
||||||
|
ripgrep \
|
||||||
|
zsh \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=build /root/.cargo/bin/bob /root/bin/bob
|
# Remove the ubuntu user, if it exists, so we can create the "swift" user.
|
||||||
COPY --from=build /root/.local/share/bob /root/.local/share/bob
|
RUN touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu || true
|
||||||
|
|
||||||
RUN cat >> /root/.bashrc <<EOF
|
# Create the "swift" user
|
||||||
PATH="/root/bin:/root/.local/share/bob/nvim-bin:$PATH"
|
RUN groupadd --gid 1000 swift \
|
||||||
alias n='nvim'
|
&& useradd -s /bin/zsh --uid 1000 --gid 1000 -m swift
|
||||||
EOF
|
|
||||||
|
|
||||||
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" ]
|
|
||||||
|
|||||||
52
README.md
52
README.md
@@ -1,38 +1,46 @@
|
|||||||
# Swift development container
|
# Swift development container
|
||||||
|
|
||||||
A development container built off swift / ubuntu as base image. This is needed because
|
A development container built off swift / ubuntu as base image. This is typically
|
||||||
I currently can not get swift to install on arch linux, so this
|
used as a base image for a `devcontainer` for for a swift project.
|
||||||
is used to develop inside a docker container.
|
|
||||||
|
|
||||||
## Extra Packages
|
|
||||||
|
## Installed Packages
|
||||||
|
|
||||||
|
This image includes my relevant dotfiles (shell, neovim, scripts, etc.) and the
|
||||||
|
following extra packages:
|
||||||
|
|
||||||
- bob (neovim version manager)
|
- bob (neovim version manager)
|
||||||
- cmake
|
|
||||||
- curl
|
- curl
|
||||||
- git
|
- direnv
|
||||||
|
- eza
|
||||||
|
- fzf
|
||||||
- neovim (nightly)
|
- neovim (nightly)
|
||||||
- tree-sitter-cli
|
- ripgrep
|
||||||
- wget
|
- starship
|
||||||
|
- zsh
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
In a new project, use this image as the base image for your dev container.
|
||||||
podman run -it --name "$(basename "$PWD")" \
|
|
||||||
-v "$HOME/.config/nvim":/root/.config/nvim \
|
**.devcontainer/devcontainer.json**
|
||||||
-v "$HOME/.local/share/nvim":/root/.local/share/nvim \
|
```json
|
||||||
-v "$PWD":/root/dev \
|
{
|
||||||
-w /root/dev \
|
"name": "Swift",
|
||||||
git.housh.dev/michael/swift-dev-container:latest
|
"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.
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user