Skip to content

Commit

Permalink
add Dockerfile for rust env
Browse files Browse the repository at this point in the history
  • Loading branch information
wongsingfo committed Oct 30, 2023
1 parent d43ba1c commit c5303c7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- cron: "0 0 1 * *"

jobs:
docker:
base:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
Expand All @@ -32,3 +32,22 @@ jobs:
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64
file: ./base.Dockerfile
rust:
runs-on: ubuntu-latest
needs: [ base ]
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: wongsingfo
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: wongsingfo/dotfiles:rust
file: ./rust.Dockerfile
12 changes: 5 additions & 7 deletions base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ RUN apt-get update && apt-get install -y \
tmux \
unzip \
uuid-runtime \
&& rm -rf /var/lib/apt/lists/*

RUN chsh -s /usr/bin/fish ubuntu && \
addgroup wheel && adduser ubuntu wheel && echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/wheel
&& rm -rf /var/lib/apt/lists/* && \
chsh -s /usr/bin/fish ubuntu && \
addgroup wheel && adduser ubuntu wheel && echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/wheel

USER ubuntu
WORKDIR /work
Expand All @@ -39,10 +38,9 @@ RUN cd /home/ubuntu/.dotfiles && stow -t /home/ubuntu -R *

RUN fish -c 'curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install PatrickF1/fzf.fish'

RUN curl -L https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz | sudo tar zxf - -C /usr/local/ --strip-components=1

# The "sleep *" is a workaround for https://github.com/nvim-treesitter/nvim-treesitter/issues/2900
RUN nvim --headless +"Lazy restore" +"TSUpdateSync" +"MasonUpdate" \
RUN curl -L https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz | sudo tar zxf - -C /usr/local/ --strip-components=1 && \
nvim --headless +"Lazy restore" +"TSUpdateSync" +"MasonUpdate" \
+"MasonInstall pyright" +"MasonInstall clangd" \
+"sleep 20" +qall

4 changes: 4 additions & 0 deletions rust.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM wongsingfo/dotfiles:amd64

RUN { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh /dev/stdin -y ; } && \
nvim --headless +"MasonInstall rust-analyzer" +qall
6 changes: 6 additions & 0 deletions stow-dotfiles/fish/.config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ end
if type -q fzf_configure_bindings
fzf_configure_bindings --directory=\co
end

# Check if $HOME/.cargo/bin is in $PATH
if not string match -q -r "$HOME/.cargo/bin" $PATH
# If it's not in $PATH, add it
set -x PATH $PATH $HOME/.cargo/bin
end

0 comments on commit c5303c7

Please sign in to comment.