Skip to content

Commit

Permalink
Merge pull request #33 from vncsmyrnk/32-add-custom-docker-image-for-…
Browse files Browse the repository at this point in the history
…development

Adding docker file and workflow to push dev docker image to gh registry
  • Loading branch information
vncsmyrnk authored Jun 28, 2024
2 parents 31715ca + cdd63fc commit e1e2981
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/dev-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Development environment workflow

on:
push:
branches: [ "main" ]
paths: ["Dockerfile"]

jobs:
publish-image:
needs: ci
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: |
ghcr.io/vncsmyrnk/rust-17.9-slim-dev:latest
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:22.04
SHELL ["/bin/bash", "-c"]
RUN <<EOF
apt-get update -qq
apt-get install -qq -y curl wget build-essential sudo
useradd -m -d /home/dev -s /bin/bash -u 1000 dev
adduser dev sudo
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
EOF
USER dev
RUN <<EOF
sh <(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs) -y
source $HOME/.cargo/env
EOF
WORKDIR /home/dev
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ bash <(wget -O- https://github.com/vncsmyrnk/todayiwill/releases/latest/download

```bash
docker run --rm -it \
-v "$(pwd)":/opt/app \
-v ~/.ssh:/root/.ssh \
-v "$(pwd)":/home/dev/app \
-v ~/.ssh:/home/dev/.ssh \
-e GIT_USERNAME="$(git config --list | grep "user.name" | cut -d = -f2)" \
-e GIT_EMAIL="$(git config --list | grep "user.email" | cut -d = -f2)" \
-u dev \
--cpus 2 \
--workdir /opt/app \
rust:1.79-slim bash
--workdir /home/dev/app \
ghcr.io/vncsmyrnk/rust-17.9-slim-dev:latest bash
```

### Dev Tools

Once inside the container, you can run `$ sudo -E ./dev-setup.sh` to install dev dependencies like `git` and `nvim`.
Empty file modified install-linux-debian.sh
100755 → 100644
Empty file.

0 comments on commit e1e2981

Please sign in to comment.