Skip to content

Commit

Permalink
add amazon linux zsh module
Browse files Browse the repository at this point in the history
  • Loading branch information
snigdhasjg committed Sep 13, 2023
1 parent 1e74a5f commit 08e512c
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 6 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/docker-hub-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ jobs:
with:
fetch-depth: 1

- name: Docker Hub Description
- name: Docker Hub Description ZSHbuntu
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: macabrequinox/zshbuntu
repository: ${{ vars.DOCKERHUB_USERNAME }}/zshbuntu
short-description: "Your Ultimate Ubuntu Image with Zsh Magic!"
readme-filepath: "./zshbuntu/docs/README.md"
readme-filepath: "./zshbuntu/docs/README.md"

- name: Docker Hub Description ZSHmazon
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ vars.DOCKERHUB_USERNAME }}/zshmazon
short-description: "Your Ultimate AmazonLinux2023 Image with Zsh Magic!"
readme-filepath: "./zshmazon/docs/README.md"
31 changes: 29 additions & 2 deletions .github/workflows/docker-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
echo "git_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- id: zshbuntu
name: Build zshbuntu
name: Build ZSHbuntu
uses: docker/build-push-action@v5
with:
context: zshbuntu/
Expand All @@ -57,15 +57,42 @@ jobs:
org.opencontainers.image.created=${{ steps.metadata.outputs.current_date }}
org.opencontainers.image.revision=${{ github.sha }}
- id: zshmazon
name: Build ZSHmazon
uses: docker/build-push-action@v5
with:
context: zshmazon/
no-cache: true
push: true
tags: ${{ vars.DOCKERHUB_USERNAME }}/zshmazon:latest,${{ vars.DOCKERHUB_USERNAME }}/zshmazon:${{ steps.metadata.outputs.git_tag }}
platforms: linux/amd64,linux/arm64/v8
labels: |
org.opencontainers.image.title=zshmazon
org.opencontainers.image.url=${{ github.repositoryUrl }}
org.opencontainers.image.version=${{ steps.metadata.outputs.git_tag }}
org.opencontainers.image.created=${{ steps.metadata.outputs.current_date }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Summary
run: |
{
echo -e "Image: ${{ fromJson(steps.zshbuntu.outputs.metadata)['image.name'] }}\n"
echo -e "# Image: ${{ fromJson(steps.zshbuntu.outputs.metadata)['image.name'] }}\n"
echo '<details>'
echo '<summary>Details</summary>'
echo -e '\n```'
echo -e "${{ steps.zshbuntu.outputs.metadata }}"
echo -e '```'
echo '</details>'
echo -e '\n'
} >> $GITHUB_STEP_SUMMARY
{
echo -e "# Image: ${{ fromJson(steps.zshmazon.outputs.metadata)['image.name'] }}\n"
echo '<details>'
echo '<summary>Details</summary>'
echo -e '\n```'
echo -e "${{ steps.zshmazon.outputs.metadata }}"
echo -e '```'
echo '</details>'
echo -e '\n'
} >> $GITHUB_STEP_SUMMARY
3 changes: 2 additions & 1 deletion zshbuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ FROM ubuntu:${UBUNTU_VERSION}
RUN apt update
RUN apt install -y zsh sudo systemd vim iputils-ping curl && \
# apt install -y python3 pip && \
apt install -y git tig
apt install -y git tig && \
apt clean

# Creating user
RUN useradd -rm -d /home/sandbox -s /usr/bin/zsh -g root -G root -u 1001 sandbox && \
Expand Down
29 changes: 29 additions & 0 deletions zshmazon/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG AMAZON_LINUX_VERSION=2023
FROM amazonlinux:${AMAZON_LINUX_VERSION}

RUN yum update
RUN yum install -y zsh sudo vim iputils tar && \
# apt install -y python3 pip && \
yum install -y git tig && \
yum clean all

# Creating user
RUN useradd -rm -d /home/sandbox -s /usr/bin/zsh -g root -G root -u 1001 sandbox && \
echo "sandbox ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/sudoers

USER sandbox
WORKDIR /home/sandbox

RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
RUN git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \
git clone --depth=1 https://github.com/akarzim/zsh-docker-aliases.git ~/.oh-my-zsh/custom/plugins/zsh-docker-aliases && \
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-docker-aliases)/' .zshrc && \
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k && \
sed -i 's|ZSH_THEME=.*|ZSH_THEME="powerlevel10k/powerlevel10k"|' .zshrc

RUN git config --global init.defaultBranch main && \
git config --global user.name "Ubuntu Sandbox" && \
git config --global user.email "[email protected]"

CMD ["zsh"]
46 changes: 46 additions & 0 deletions zshmazon/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Welcome to ZSHmazon – Your Ultimate AmazonLinux Image with Zsh Magic!

Discover a world of command-line sophistication with our ZSHmazon Docker image. We've curated the perfect AmazonLinux environment enhanced with the power of Zsh, Oh-My-Zsh. Elevate your terminal experience with this feature-packed image, designed to boost your productivity and style.

Whether you're a developer, system administrator, or terminal enthusiast, ZSHmazon empowers you with a captivating, efficient, and fun command-line experience. Download now and unlock the full potential of your AmazonLinux-based containers.

<img src="https://raw.githubusercontent.com/snigdhasjg/docker-images/main/zshmazon/docs/terminal.png" width="512" alt="Terminal Example">

## Key Features:

- AmazonLinux base with [Zsh](https://en.wikipedia.org/wiki/Z_shell) magic.
- [Oh-My-Zsh](https://ohmyz.sh) for enhanced shell capabilities.
- [Powerlevel10k](https://github.com/romkatv/powerlevel10k) for eye-catching, customizable prompts.
- [Syntax highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) for code clarity.
- Vibrant [auto-suggestions](https://github.com/zsh-users/zsh-autosuggestions) for faster typing.
- [Zsh Docker Aliases](https://github.com/akarzim/zsh-docker-aliases) for streamlined container management.

## Modules Installed
zsh, sudo, vim, tar, iputils, git, tig

## How to Use ZSHmazon

### Run the ZSHmazon Docker Sandbox:
- To run the Docker image with the previously created volume mounted to `/home/sandbox` for the user `sandbox`, use the following command:
```shell
docker run --name sandbox -v zshmazon-sandbox:/home/sandbox --rm -it macabrequinox/zshmazon
```
- Along with running the container, this command creates a docker volume named `zshmazon-sandbox`.
- This command starts the ZSHmazon Docker container, providing you with a secure and permission-free environment to run commands and experiment.
- Once you exit, it automatically deletes the container instance.

Now you're ready to enjoy your ZSHmazon Docker Sandbox, where you can safely execute commands without worrying about permissions or security issues.
Feel free to customize your environment and configurations within the sandbox, and any changes on home directory will be stored in the `zshmazon-sandbox` volume for future use.

### To Have a Fresh Start Again:
- reset all settings just delete the `ZSHmazon-sandbox` volume by running the following command:
```shell
docker volume rm zshmazon-sandbox
```
- This volume was storing your configuration and setups of docker image's home directory.

## Contribute
On [GitHub](https://github.com/snigdhasjg/docker-images/tree/main/zshmazon) by editing the [Dockerfile](https://github.com/snigdhasjg/docker-images/tree/main/zshmazon/Dockerfile)

---
Tags: #AmazonLinux #Zsh #OhMyZsh #Powerlevel10k #SyntaxHighlighting #AutoSuggestions #DockerImage #CommandLine #DeveloperTools #Productivity
Binary file added zshmazon/docs/terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 08e512c

Please sign in to comment.