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

Commit

Permalink
(#87) v0.3.2:
Browse files Browse the repository at this point in the history
* (#77) Make quick little fixes;
* (#78) Fix locale and add `less`;
* (#82) Add `ncdu`, `make`, `zip` and `unzip`;
* (#83) Make corrections for the comments and the description;
* (#84) Make few Julia updates;
* (#86) Add more support for remote development with GUI.
  • Loading branch information
Pavel Sobolev authored Aug 17, 2020
2 parents 09544ce + 1381fc9 commit fec9066
Show file tree
Hide file tree
Showing 21 changed files with 223 additions and 198 deletions.
6 changes: 3 additions & 3 deletions .github/config/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ template: |
version-resolver:
major:
labels:
- 'Major'
- 'major'
minor:
labels:
- 'Minor'
- 'minor'
patch:
labels:
- 'Patch'
- 'patch'
default: patch
File renamed without changes
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ubuntu:20.04

# Meta information
LABEL maintainer="Pavel Sobolev (https://github.com/Paveloom)"
LABEL version="0.3.1"
LABEL version="0.3.2"
LABEL description="This is an image containing paveloom's personal development environment."
LABEL github-repository="https://github.com/paveloom-d/dev"
LABEL docker-repository="https://hub.docker.com/r/paveloom/dev"
Expand Down Expand Up @@ -35,6 +35,12 @@ ENV HOME /home/$USER
# Set up a new user
RUN /docker-scripts/root/user/set-up-new-user.sh

# Install X2Go Server and XFCE
RUN /docker-scripts/root/x2go-server/install-x2go-server.sh

# Install the browser
RUN /docker-scripts/root/browser/install-browser.sh

# Install Zsh
RUN /docker-scripts/root/zsh/install-zsh.sh

Expand All @@ -53,7 +59,7 @@ RUN /docker-scripts/root/docker/install-docker.sh
# Install Node.js and npm
RUN /docker-scripts/root/nodejs-and-npm/install-nodejs-and-npm.sh

# Install rclone
# Install Rclone
RUN /docker-scripts/root/rclone/install-rclone.sh

# Install TexLive
Expand Down Expand Up @@ -87,7 +93,4 @@ RUN /docker-scripts/user/julia/install-julia.sh
COPY user-scripts Scripts

# Remove docker scripts
RUN sudo rm -rf /docker-scripts

# Set DEBIAN_FRONTEND to teletype
ENV DEBIAN_FRONTEND=teletype
RUN sudo rm -rf /docker-scripts
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@
dive build -t image --squash .
docker images -q | grep -E -v "$$(docker images -q 'image')|$$(docker images -q 'ubuntu')" | xargs docker rmi

# Build an image squashing all layers, delete redundant layers
build-f :
docker build -t image --squash .
docker images -q | grep -E -v "$$(docker images -q 'image')|$$(docker images -q 'ubuntu')" | xargs docker rmi

## Run a container
run :
docker run -p 5001:22 -p 8888:8888 -v /var/run/docker.sock:/var/run/docker.sock --name container -t -d image
docker run -p 5001:22 -p 8888:8888 -p 8889:8889 -v /var/run/docker.sock:/var/run/docker.sock --name container -t -d image

## Enter the container
in :
Expand Down
126 changes: 85 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,43 @@

### A notice

If you are not sure, please, follow only the instructions from the last tagged commit on the `master` branch.
If you are unsure, please refer to the description on the last commit on the
[`master`](https://github.com/paveloom-d/dev/tree/master) branch.

### Development

There is a ZenHub board, so make sure you have installed the extension to see in which pipelines the issues are.
There is a [ZenHub](https://www.zenhub.com/) board, so if you want to see it, make sure you
have the extension installed.

### Contents
### Content of the image

- Image version: 0.3.1
- Image version: 0.3.2
- Base image: Ubuntu (20.04)
- Essential packages:
- apt-utils
- apt-transport-https
- dialog
- htop
- ca-certificates
- git
- make
- ncdu
- zip
- unzip
- nano
- less
- wget
- curl
- gnupg-agent
- sudo (1.9.1)
- ssh
- locales
- software-properties-common
- Non-root user set-up
- [Keychain to manage your SSH keys](#keychain)
- [Auxiliary user scripts](#user-scripts)
- X2Go Server and XFCE DE
- Midori Web Browser
- [Auxiliary user scripts](#users-scripts)
- Zsh as the default shell:
- [OhMyZsh](https://github.com/ohmyzsh/ohmyzsh):
- Additional plugins:
Expand All @@ -44,12 +56,15 @@ There is a ZenHub board, so make sure you have installed the extension to see in
- jupyter
- jupyterlab
- [Aliases to run a notebook server](#jupyter)
- Julia (1.4.2):
- Julia (1.5.0):
- [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl)
- [Literate.jl](https://github.com/fredrikekre/Literate.jl)
- [Revise.jl](https://github.com/timholy/Revise.jl)
- [IJulia.jl](https://github.com/JuliaLang/IJulia.jl/)
- [PyPlot.jl](https://github.com/JuliaPy/PyPlot.jl)
- [Plots.jl](https://github.com/JuliaPlots/Plots.jl)
- Node.js and npm
- Rclone
- TexLive:
- dvipng
- texlive-latex-extra
Expand All @@ -62,114 +77,135 @@ There is a ZenHub board, so make sure you have installed the extension to see in
This image can be downloaded from [Docker Hub](https://hub.docker.com/r/paveloom/dev):

```bash
docker pull paveloom/dev:0.3.1
docker pull paveloom/dev:0.3.2
```

or from [GitHub Packages](https://github.com/paveloom-d/dev/packages):

```bash
docker pull docker.pkg.github.com/paveloom-d/dev/dev:0.3.1
docker pull docker.pkg.github.com/paveloom-d/dev/dev:0.3.2
```

### Build, Run, Enter
After that, you can run a container based on that image. If you want to build the image
yourself, see the next section.

There is nothing specific when building, although I would recommend squashing the image. This means using docker's `--squash` option, which is an experimental feature. To enable it, be sure to put the following code in `/etc/docker/daemon.json`:
### Build, run, and enter

There is nothing special when building, although I would recommend squashing the image.
By this means using the Docker's `--squash` flag, which is an experimental feature.
To enable it, make sure you have the following code in the `/etc/docker/daemon.json` file:

```json
{
"experimental": true
}
```

To build the image run the following in the root directory (where Dockerfile is located):
To build the image, execute the following in the root directory:

```bash
docker build -t image --squash .
```

If you want to develop docker containers inside the container, it is recommended to bind-mount Docker socket when running it as follows:
You can then run the container as follows:

```bash
docker run -v /var/run/docker.sock:/var/run/docker.sock --name container -t -d image
docker run --name container -t -d image
```

This requires that your local socket has read and write privileges for others group. You can give them like this:
Since Zsh is the default shell, you can enter the container using the following command:

```bash
sudo chmod o+rw /var/run/docker.sock
docker exec -it container zsh
```

If you don't need this functionality, you can omit the `-v` flag above.
### Using Docker inside

Since Zsh is the default shell, you can enter the container using the following command:
Bind mounting the Docker socket allows you to develop other images inside a running
container. This requires that the `others` group has read and write privileges relative
to your local socket. You can give these privileges as follows:

```bash
docker exec -it container zsh
sudo chmod o+rw /var/run/docker.sock
```

There is also a [Makefile](https://github.com/paveloom-d/dev/blob/master/Makefile) published, which I use for the development. You can use it to execute the procedure above as simple as:
After that, the container should be run with an additional `-v` flag:

```bash
make build
make run
make in
docker run -v /var/run/docker.sock:/var/run/docker.sock --name container -t -d image
```

The build rule will call [dive](https://github.com/wagoodman/dive), so be sure you have this tool, or just change `dive` to `docker` inside the Makefile. Be mindful though that the build rule here will delete all other images except mine and Alpine's.

### Jupyter

To use Jupyter Notebook / Jupyter Lab you will need to do two things.
To use Jupyter Notebook or Jupyter Lab you will need to do two things.

First, publish the `8888` port when running a container:
First, publish the `8888` port (or any other, but this one is standard) when running a
container:

```bash
docker run -p 8888:8888 --name container -t -d image
```

Secondly, when in the container, make notebook server listen on `0.0.0.0`:
Secondly, while inside the container, run the notebook server listening on IP `0.0.0.0`:

```bash
jupyter notebook --ip 0.0.0.0 --no-browser
```

There are convenient aliases for the last step: `jnote` for Jupyter Notebook and `jlab` for Jupyter Lab.
There are handy aliases for the last step: `jnote` for Jupyter Notebook and `jlab` for
Jupyter Lab.

### User's password

The default user doesn't have password specified (although it exists and will be prompted if trying to [SSH in a container](#ssh)), so you can easily run `sudo`'s commands. But if you want to specify it, run `passwd $USER` as root.
The system (by default) will not ask the user to enter a password (this makes it easier to
run administrator commands), but this password exists and will be asked when you try to
establish an [SSH connection](#ssh) with a container from the outside. If you want to set
this password, run `passwd $USER` as root.

### SSH

To SSH into a container you will need to map the container's `22` port (or any other configured by `/etc/ssh/sshd_config`) to any accessible host's port (for example, `5001`).
To establish an SSH connection to the container, you need to map the container's `22` port
to any other port available and not occupied on the host machine (for example, `5001`).

This can be done running a container using the `-p` flag:
This can be accomplished by running the container using the `-p` flag:

```bash
docker run -p 5001:22 --name container -t -d image
```

Remember, you cannot expose new ports once the container is up.
Remember, you can't publish new ports when the container is already running.

If ssh service is running (this is done automatically when creating a new shell, but you can check by `service ssh status`), you can SSH into the container like so:
If the SSH service is running inside the container (it starts automatically when you
open a new shell instance, however, you can check this by doing `service ssh status`),
you can SSH into the container as follows:

```bash
ssh -p 5001 username@remote
```

This will prompt for `username`'s password. If you haven't done this yet, [set it up](#users-password).
This will prompt for the `username`'s password. If you haven't done this yet,
[set it up](#users-password).

### Keychain

Instead of calling `ssh-add` every time, you can add your SSH key(s) using `keychain`. There are corresponding lines for this in `~/.zshrc` specifying the key(s), just uncomment them.
Instead of calling `ssh-add` every time, you can add your SSH key(s) using `keychain`.
The corresponding lines are present in the `~/.zshrc`, just uncomment them and specify
your keys.

### User scripts
### User's scripts

The image provides auxillary scripts to help a user to generate SSH and GPG keys and connect them to a GitHub account. They are located in `~/Scripts`.
The image provides auxiliary scripts that can help the user create SSH and GPG keys and
connect them to an account on GitHub. They are located in `~/Scripts`.

### Key bindings

This image contains key bindings for deleting words before and after the cursor: <kbd>Ctrl+Backspace</kbd> and <kbd>Ctrl+Delete</kbd> respectively. However, if you are using Windows Terminal, you may find out that the first one doesn't work when using SSH. This has been discussed [here](https://github.com/microsoft/terminal/issues/755), and one of the solutions that you may use is this [AutoHotkey](https://www.autohotkey.com/) script:
This image provides keyboard shortcuts to delete a word before and after the cursor:
<kbd>Ctrl+Backspace</kbd> and <kbd>Ctrl+Delete</kbd> respectively. However, if you are
using [Windows Terminal](https://github.com/microsoft/terminal), you may find that the
first one does not work when you use an SSH connection. This has been discussed
[here](https://github.com/microsoft/terminal/issues/755),
and one of the solutions that you can use is this [AutoHotkey](https://www.autohotkey.com/)
script:

```autohotkey
; For Windows Terminal: deletes the previous word
Expand All @@ -182,7 +218,11 @@ return

### Color theme

Different terminals (like Xterm), programs (like Visual Studio Code) and utilities (like PuTTY) have their own color pallettes. So current theme may look ugly depending on what you use to enter the container. Since it's my image, I made it look more or less attractive when using [Windows Terminal](https://github.com/microsoft/terminal) with the following 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
on what you use to enter the container. Since this is my image, I made it look more or less
attractive when using [Windows Terminal](https://github.com/microsoft/terminal) with the
following scheme:

```json
{
Expand All @@ -208,6 +248,10 @@ Different terminals (like Xterm), programs (like Visual Studio Code) and utiliti
}
```

This one is based on [synthwave-everything](https://atomcorp.github.io/themes/?theme=synthwave-everything), which, I guess, was supposed to be used for local development. I made some changes to make it usable for remote development. So, with this being set up correctly, it should be looking something like this:
It's based on
[`synthwave-everything`](https://atomcorp.github.io/themes/?theme=synthwave-everything),
which I believe was intended for local development. I made a few changes to make it
suitable for remote development. With everything else set correctly, the terminal window
should look like this:

![](https://github.com/paveloom-d/dev/raw/master/.github/pictures/colors.png)
![](https://github.com/paveloom-d/dev/raw/master/.github/pictures/color-theme.png)
6 changes: 6 additions & 0 deletions docker-scripts/root/browser/install-browser.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

echo '\n\e[1;36mInstalling the browser:\e[0m'

echo '\e[1;36m> Installing Midori:\e[0m\n'
apt-get install -y --no-install-recommends midori >/dev/null
15 changes: 4 additions & 11 deletions docker-scripts/root/docker/install-docker.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/bin/sh

# Print info
echo '\n\e[1;36mInstalling Docker:\e[0m'

# Update lists of packages
echo '\e[1;36m> Updating lists of packages...\e[0m'
apt-get update >/dev/null

# Add docker's official GPG key
echo "\e[1;36m> Addding docker's official GPG key...\e[0m"
echo "\e[1;36m> Addding Docker's official GPG key...\e[0m"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - >/dev/null

# Set up stable repository
echo '\e[1;36m> Setting up stable repository...\e[0m'
echo '\e[1;36m> Setting up the stable repository...\e[0m'
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" >/dev/null

# Install Docker engine
echo '\e[1;36m> Installing Docker engine...\e[0m'
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io >/dev/null

# Add the user to the docker group
echo '\e[1;36m> Adding the user to the docker group...\e[0m'
echo '\e[1;36m> Adding the user to the `docker` group...\e[0m'
usermod -aG docker $USER

# Clean the apt cache
echo '\e[1;36m> Cleaning the apt cache...\e[0m\n'
echo '\e[1;36m> Cleaning the `apt` cache...\e[0m\n'
rm -rf /var/lib/apt/lists/*
Loading

0 comments on commit fec9066

Please sign in to comment.