Skip to content

Commit ac052da

Browse files
committed
feat: initialize project with Docker-based development environment and configuration files
1 parent 98fdf2d commit ac052da

10 files changed

Lines changed: 251 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Log into registry ${{ env.REGISTRY }}
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Extract Docker metadata
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
tags: |
37+
type=raw,value=latest
38+
type=sha,format=short
39+
40+
- name: Build and push Docker image
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
build-args: |
48+
DEV_USER=savdert
49+
DEV_UID=1000
50+
DEV_GID=1000

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
.venv
3+
node_modules
4+
*.swp
5+

Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Use Ubuntu 24.04 as the base image
2+
FROM ubuntu:24.04
3+
4+
# Build-time arguments
5+
ARG DEV_USER=savdert
6+
ARG DEV_UID=1000
7+
ARG DEV_GID=1000
8+
ARG TZ=Europe/Istanbul
9+
10+
# Environment variables
11+
ENV DEBIAN_FRONTEND=noninteractive \
12+
SHELL=/usr/bin/zsh \
13+
LANG=en_US.UTF-8 \
14+
LC_ALL=en_US.UTF-8 \
15+
PATH="/home/${DEV_USER}/.local/bin:/opt/mise/bin:/opt/mise/shims:${PATH}"
16+
17+
# Install core system dependencies
18+
RUN apt-get update && apt-get install -y --no-install-recommends \
19+
curl \
20+
git \
21+
sudo \
22+
zsh \
23+
ttyd \
24+
ca-certificates \
25+
locales \
26+
tzdata \
27+
unzip \
28+
build-essential \
29+
libssl-dev \
30+
pkg-config \
31+
&& rm -rf /var/lib/apt/lists/*
32+
33+
# Setup locale and timezone
34+
RUN locale-gen en_US.UTF-8 && \
35+
ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone
36+
37+
# Create the user with sudo privileges
38+
RUN groupadd -g ${DEV_GID} ${DEV_USER} && \
39+
useradd -m -u ${DEV_UID} -g ${DEV_GID} -s /usr/bin/zsh ${DEV_USER} && \
40+
echo "${DEV_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
41+
42+
# Install mise globally
43+
RUN curl https://mise.run | sh && \
44+
mv /root/.local/bin/mise /usr/local/bin/mise
45+
46+
# Setup project directory
47+
WORKDIR /workspace
48+
COPY . /workspace
49+
RUN chown -R ${DEV_USER}:${DEV_USER} /workspace /home/${DEV_USER}
50+
51+
USER ${DEV_USER}
52+
53+
# Install tools via mise during the build (caching tools in the image)
54+
RUN mise trust --quiet && \
55+
mise install --yes
56+
57+
# Symlink configurations to the user's home directory
58+
RUN mkdir -p ${HOME}/.config/zellij ${HOME}/.config/nvim && \
59+
ln -sf /workspace/configs/.zshrc ${HOME}/.zshrc && \
60+
ln -sf /workspace/configs/starship.toml ${HOME}/.config/starship.toml && \
61+
ln -sf /workspace/configs/zellij/config.kdl ${HOME}/.config/zellij/config.kdl
62+
63+
# Expose the ttyd port
64+
EXPOSE 7681
65+
66+
# Command to launch ttyd with zsh
67+
ENTRYPOINT ["ttyd", "-W", "-p", "7681", "/usr/bin/zsh"]

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Dev Environment
2+
3+
Mise-native development environment for Dokploy.
4+
5+
## Features
6+
- **Mise** for tool management.
7+
- **ttyd** for browser-based terminal.
8+
- **Zsh** with Starship prompt.
9+
- **Configs** managed in `configs/`.
10+
11+
## Deployment
12+
This image is automatically published to `ghcr.io/msavdert/dotfiles` via GitHub Actions.
13+
14+
## Local Development
15+
```bash
16+
docker-compose up -d
17+
```
18+
Access the terminal at `http://localhost:7681`.
19+

configs/.zshrc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# --- Mise-en-place ---
2+
if [ -f "$HOME/.local/bin/mise" ]; then
3+
export PATH="$HOME/.local/bin:$PATH"
4+
eval "$($HOME/.local/bin/mise activate zsh)"
5+
elif command -v mise &>/dev/null; then
6+
eval "$(mise activate zsh)"
7+
fi
8+
9+
# --- Starship Prompt ---
10+
if command -v starship &>/dev/null; then
11+
eval "$(starship init zsh)"
12+
fi
13+
14+
# --- Zoxide (Smart cd) ---
15+
if command -v zoxide &>/dev/null; then
16+
eval "$(zoxide init zsh)"
17+
fi
18+
19+
# --- Aliases ---
20+
alias ls='eza --icons'
21+
alias ll='eza -l --icons'
22+
alias la='eza -la --icons'
23+
alias cat='bat --style=plain'
24+
alias g='git'
25+
alias lg='lazygit'
26+
27+
# --- 1Password Helper ---
28+
if [ -n "$OP_SERVICE_ACCOUNT_TOKEN" ]; then
29+
export OP_SESSION_my="$(op signin --raw)"
30+
fi
31+
32+
# --- History ---
33+
HISTFILE=~/.zsh_history
34+
HISTSIZE=10000
35+
SAVEHIST=10000
36+
setopt APPEND_HISTORY
37+
setopt SHARE_HISTORY
38+
39+
# --- Keybindings ---
40+
bindkey -e

configs/nvim/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Neovim Configuration
2+
This directory is a placeholder for your Neovim configurations.
3+

configs/starship.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Starship configuration
2+
format = """
3+
$username\
4+
$hostname\
5+
$directory\
6+
$git_branch\
7+
$git_state\
8+
$git_status\
9+
$cmd_duration\
10+
$line_break\
11+
$character"""
12+
13+
[directory]
14+
style = "blue"
15+
read_only = " 󰌾"
16+
17+
[character]
18+
success_symbol = "[➜](bold green)"
19+
error_symbol = "[➜](bold red)"
20+
21+
[git_branch]
22+
symbol = ""
23+
style = "bold purple"
24+
25+
[git_status]
26+
style = "red"

configs/zellij/config.kdl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
theme "default"
2+
pane_frames false
3+
default_layout "compact"
4+
on_force_close "detach"
5+
simplified_ui true
6+

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
workspace:
3+
build:
4+
context: .
5+
args:
6+
DEV_USER: ${DEV_USER:-savdert}
7+
image: ghcr.io/msavdert/dotfiles:latest
8+
container_name: dev-workspace
9+
ports:
10+
- "7681:7681"
11+
volumes:
12+
- .:/workspace
13+
- dev_home:/home/${DEV_USER:-savdert}
14+
environment:
15+
- OP_SERVICE_ACCOUNT_TOKEN=${OP_SERVICE_ACCOUNT_TOKEN:-}
16+
restart: always
17+
18+
volumes:
19+
dev_home:
20+

mise.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tools]
2+
neovim = "latest"
3+
zellij = "latest"
4+
uv = "latest"
5+
zoxide = "latest"
6+
fzf = "latest"
7+
starship = "latest"
8+
usage = "latest"
9+
eza = "latest"
10+
bat = "latest"
11+
lazygit = "latest"
12+
"1password-cli" = "latest"
13+
14+
[settings]
15+
task.source_freshness_hash_contents = true

0 commit comments

Comments
 (0)