Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
(#144) Apply fixes, switch to Fish shell:
Browse files Browse the repository at this point in the history
* Fix the command that sets the `DISPLAY` variable;
* Switch to the `bitnami/git` base image;
* Check what is provided by the image;
* Don't use `--storage-opt` option when building;
* Setup Fish shell;
* Update the description;
* Add `--chown` to `COPY` instructions in `Dockerfile`;
* Update the screenshot.
  • Loading branch information
Pavel Sobolev authored May 1, 2021
1 parent 6dd9c6c commit 265bb76
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 179 deletions.
Binary file added .github/pictures/color-scheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .github/pictures/color-theme.png
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/scripts/publish.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# A script to build and push the image

# Build the image
podman --storage-opt=overlay.mount_program=/usr/bin/fuse-overlayfs build --squash-all -t ${IMAGENAME} .
podman build --squash-all -t ${IMAGENAME} .

# Login to the GHCR
echo ${GHCR_PAT} | podman login ghcr.io -u ${USERNAME} --password-stdin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@master
- name: Build the image
run: podman --storage-opt=overlay.mount_program=/usr/bin/fuse-overlayfs build --squash-all -t dev .
run: podman build --squash-all -t dev .
- name: Run a container
run: |
podman run --name container -td dev
Expand Down
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Base image
FROM docker.io/bitnami/minideb:buster
FROM docker.io/bitnami/git:2

# Meta information
LABEL maintainer="Pavel Sobolev (https://github.com/Paveloom)"
LABEL version="0.5.0"
LABEL version="0.6.0"
LABEL description="This is an image containing paveloom's personal development environment."
LABEL github-repository="https://github.com/paveloom-d/dev"
LABEL image-repository="https://github.com/orgs/paveloom-d/packages/container/package/dev"
Expand All @@ -17,11 +17,11 @@ RUN chmod -R +x /build-scripts
# Install essential packages
RUN /build-scripts/root/install-essential-packages.bash

# Install Zsh
RUN /build-scripts/root/install-zsh.bash
# Install Fish
RUN /build-scripts/root/install-fish.bash

# Set `SHELL` to Zsh
ENV SHELL /bin/zsh
# Set `SHELL` to Fish
ENV SHELL /bin/fish

# Specify new user
ENV USER=paveloom
Expand All @@ -36,19 +36,16 @@ RUN /build-scripts/root/set-up-a-new-user.bash
WORKDIR $HOME

# Copy user scripts
COPY user-scripts Scripts
COPY --chown=$USER:$USER user-scripts Scripts

# Allow their execution and let the user own them
RUN chown -R $USER:$USER Scripts && chmod -R +x Scripts
RUN chmod -R +x Scripts

# Switch to the created user
USER $USER

# Point to the hosts file for SSH
RUN /build-scripts/user/add-configs.bash

# Install OhMyZsh
RUN /build-scripts/user/install-ohmyzsh.bash
# Copy the user's configuration files
COPY --chown=$USER:$USER configs /home/$USER

# Remove build scripts
RUN sudo rm -rf /build-scripts
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Pavel Sobolev
Copyright (c) 2021 Pavel Sobolev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,29 @@ See all details under the spoiler:
<details>
<summary>Content of the image</summary>
<ul>
<li>Base image: <a href="https://github.com/bitnami/minideb">minideb</a> (<em>buster</em>)</li>
<li>Essential packages:</li>
<li>Base image: <a href="https://github.com/bitnami/bitnami-docker-git">bitnami/git</a></li>
<li>Additional essential packages:</li>
<ul>
<li><code>apt-utils</code></li>
<li><code>exa</code></li>
<li><code>ncurses-bin</code></li>
<li><code>htop</code></li>
<li><code>ca-certificates</code></li>
<li><code>git</code></li>
<li><code>ncdu</code></li>
<li><code>zip</code></li>
<li><code>unzip</code></li>
<li><code>nano</code></li>
<li><code>less</code></li>
<li><code>wget</code></li>
<li><code>curl</code></li>
<li><code>gpg</code></li>
<li><code>gnupg-agent</code></li>
<li><code>sudo</code></li>
<li><code>ssh</code></li>
<li><code>keychain</code></li>
<li><code>locales</code></li>
</ul>
<li>Non-root user set-up</li>
<li><a href="#what-is-this-keychain-thing">Keychain to manage your SSH keys</a></li>
<li><a href="#auxiliary-user-scripts-huh-whats-that">Auxiliary user scripts</a></li>
<li>Zsh as the default shell:</li>
<ul>
<li><a href="https://github.com/ohmyzsh/ohmyzsh">OhMyZsh</a></li>
<ul>
<li>Additional plugins:</li>
<ul>
<li>
<a href="https://github.com/zsh-users/zsh-autosuggestions">
<code>
zsh-autosuggestions
</code>
</a>
</li>
</ul>
<li><a href="#theme-adjustments-why">Theme adjustments</a></li>
</ul>
</ul>
<li>Fish as the default shell</li>
<li><a href="#color-scheme">Color scheme</a></li>
</ul>
</details>

Expand Down Expand Up @@ -104,10 +86,10 @@ You can then run a container based on this image as follows:
podman run --name container -t -d dev
```

Since Zsh is the default shell, you can enter the container using the following command:
Since Fish is the default shell, you can enter the container using the following command:

```bash
podman exec -it container zsh
podman exec -it container fish
```

### I don't see any password requests. Is that normal?
Expand Down Expand Up @@ -147,7 +129,7 @@ This will prompt for the `username`'s password. If you haven't done this yet,

Instead of calling `ssh-add` every time you log-in, you can add your SSH key(s) using
[`keychain`](https://linux.die.net/man/1/keychain). The corresponding lines are present
in the `~/.zshrc`, just uncomment them and specify your keys.
in the `~/.config/fish/config.fish`, just uncomment them and specify your keys.

### Auxiliary user scripts, huh? What's that?

Expand All @@ -159,7 +141,7 @@ Also, scripts to install the latest stable versions of Julia and Rust are includ

They are located in `~/Scripts`.

### Theme adjustments? Why?
### Color scheme?

Different terminals (like Xterm), programs (like Visual Studio Code) and utilities
(like PuTTY) have their own color pallettes. So the current theme can look ugly depending
Expand Down Expand Up @@ -195,4 +177,4 @@ It's based on
[`synthwave-everything`](https://atomcorp.github.io/themes/?theme=synthwave-everything).
With everything else set correctly, the terminal window should look like this:

![](https://github.com/paveloom-d/dev/raw/master/.github/pictures/color-theme.png)
![](./.github/pictures/color-scheme.png)
24 changes: 9 additions & 15 deletions build-scripts/root/install-essential-packages.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

echo -e '\n\e[1;36mInstalling essential packages:\e[0m'

# Create a symbolic link to Git
ln -s /opt/bitnami/git/bin/git /usr/bin/git

echo -e '\e[1;36m> Installing `apt-utils`...\e[0m'
install_packages apt-utils >/dev/null 2>&1

echo -e '\e[1;36m> Installing `htop`...\e[0m'
install_packages htop >/dev/null
echo -e '\e[1;36m> Installing `exa`...\e[0m'
install_packages exa >/dev/null

echo -e '\e[1;36m> Installing `ca-certificates`...\e[0m'
install_packages ca-certificates >/dev/null
echo -e '\e[1;36m> Installing `ncurses-bin`...\e[0m'
install_packages ncurses-bin >/dev/null

echo -e '\e[1;36m> Installing `git`...\e[0m'
install_packages git >/dev/null
echo -e '\e[1;36m> Installing `htop`...\e[0m'
install_packages htop >/dev/null

echo -e '\e[1;36m> Installing `ncdu`...\e[0m'
install_packages ncdu >/dev/null
Expand All @@ -29,18 +32,9 @@ install_packages less >/dev/null
echo -e '\e[1;36m> Installing `wget`...\e[0m'
install_packages wget >/dev/null

echo -e '\e[1;36m> Installing `curl`...\e[0m'
install_packages curl >/dev/null

echo -e '\e[1;36m> Installing `gpg` and `gnupg-agent`...\e[0m'
install_packages gpg gnupg-agent >/dev/null

echo -e '\e[1;36m> Installing `sudo`...\e[0m'
install_packages sudo >/dev/null

echo -e '\e[1;36m> Installing `ssh`...\e[0m'
install_packages ssh >/dev/null

echo -e '\e[1;36m> Installing `keychain`...\e[0m'
install_packages keychain >/dev/null

Expand Down
13 changes: 13 additions & 0 deletions build-scripts/root/install-fish.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo -e '\n\e[1;36mInstalling Fish:\e[0m'

echo -e '\e[1;36m> Installing the package...\e[0m'
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' >> /etc/apt/sources.list.d/shells:fish:release:3.list
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg > /dev/null
install_packages fish >/dev/null

echo -e '\e[1;36m> Changing the default shell...\e[0m'
sed -i -e "s/bin\/ash/usr\/bin\/fish/" /etc/passwd

echo
11 changes: 0 additions & 11 deletions build-scripts/root/install-zsh.bash

This file was deleted.

6 changes: 5 additions & 1 deletion build-scripts/root/set-up-a-new-user.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo -e '\n\e[1;36mSetting up a user:\e[0m'

echo -e '\e[1;36m> Adding a user...\e[0m'
useradd -ms /bin/zsh $USER
useradd -ms /usr/bin/fish $USER

echo -e '\e[1;36m> Disabling the password prompt...\e[0m'
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER
Expand All @@ -14,4 +14,8 @@ chmod 0440 /etc/sudoers.d/$USER
echo -e '\e[1;36m> Letting the user to own the home directory...\e[0m'
chown -R $USER:$USER $HOME

echo -e '\e[1;36m> Creating `/etc/wsl.conf`...\e[0m'
echo -e "[user]
default = $USER" > /etc/wsl.conf

echo
13 changes: 0 additions & 13 deletions build-scripts/user/add-configs.bash

This file was deleted.

90 changes: 0 additions & 90 deletions build-scripts/user/install-ohmyzsh.bash

This file was deleted.

31 changes: 31 additions & 0 deletions configs/.config/fish/config.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Go home
cd $HOME

# Disable greeting
set fish_greeting

# Key bindings

## Bind `Ctrl+Backspace` to delete a word behind the cursor
bind \b backward-kill-word

## Bind `Ctrl+Delete` to delete a word after the cursor
bind \e\[3\;5~ kill-word

# Variables

## Switch to UTF-8 encoding
set -gx LC_ALL C.UTF-8

## Make `less` not open a window if text takes up less space
set -gx LESS -FXR

## Set up the display (for WSL)
set -gx DISPLAY (cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

# Aliases
alias ls=exa
alias cfg="nano ~/.config/fish/config.fish"

# Keychain
# eval keychain -q --noask --eval id_rsa >/dev/null
Loading

0 comments on commit 265bb76

Please sign in to comment.