diff --git a/.devcontainer/.devcontainer.json b/.devcontainer/.devcontainer.json deleted file mode 100644 index 522c7a6..0000000 --- a/.devcontainer/.devcontainer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Elixir Kickoff Development Container", - "image": "ghcr.io/elixir-journey/elixir-kickoff:latest", - "remoteEnv": { - "MIX_ENV": "dev" - }, - "customizations": { - "vscode": { - "extensions": [ - "jakebecker.elixir-ls", - "ms-azuretools.vscode-docker", - "editorconfig.editorconfig", - "eamodio.gitlens", - "streetsidesoftware.code-spell-checker", - "esbenp.prettier-vscode", - "pkief.material-icon-theme" - ], - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - } - } - }, - "postCreateCommand": "mix deps.get", - "postStartCommand": "../scripts/post_start.sh", - "remoteUser": "vscode", - "mounts": [ - "source=${localWorkspaceFolder},target=/workspace,type=bind", - "source=${localEnv:HOME}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached", - "source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind,consistency=cached" - ], - "workspaceFolder": "/workspace" -} \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5b5c540..c546db5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,42 +1,46 @@ -# Use an official Elixir image as the base -FROM elixir:1.17-alpine +# Builder stage +FROM elixir:1.17-alpine AS builder -# Set default environment to development -ENV MIX_ENV=dev +ENV MIX_ENV=prod -# Install Hex, Rebar, and essential tools RUN mix do local.hex --force, local.rebar --force \ - && apk add --no-cache \ - git \ - nodejs \ - npm \ - curl \ - inotify-tools \ - bash \ - openssh \ - postgresql-client - -# Install GitHub CLI (gh) -RUN apk add --no-cache github-cli - -# Ensure .ssh directory exists -RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh - -# Set up the application directory -WORKDIR /workspace - -# Copy mix files and install dependencies + && apk add --no-cache git curl bash openssh postgresql-client + +WORKDIR /app + COPY mix.exs mix.lock ./ -RUN mix deps.get --only $MIX_ENV +RUN mix deps.get -# Copy the rest of the application code COPY . . +# Ensure directories exist +RUN mkdir -p /app/config /app/rel && mix compile + +# Final stage +FROM elixir:1.17-alpine + +ENV MIX_ENV=dev + +RUN apk add --no-cache \ + bash openssh postgresql-client \ + git curl zsh zsh-autosuggestions zsh-syntax-highlighting zsh-completions \ + && curl -sfL git.io/antibody | sh -s - -b /usr/local/bin + +WORKDIR /app + +# Copy the entire project directory +COPY . /app -# Ensure proper permissions for the workspace directory -RUN chown -R root:root /workspace +# Default Powerlevel10k configuration +RUN echo "POWERLEVEL9K_MODE=nerdfont-complete" > /root/.p10k.zsh \ + && echo '[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh' >> /root/.zshrc -# Run compilation in development mode -RUN mix compile +# Configure Zsh +RUN echo "export ZSH_THEME=\"robbyrussell\"" > /root/.zshrc \ + && echo "alias ll='ls -la'" >> /root/.zshrc \ + && echo "export SHELL=\"/bin/zsh\"" >> /root/.zshrc \ + && echo "source /root/.zsh_plugins.sh" >> /root/.zshrc \ + && antibody bundle zsh-users/zsh-autosuggestions > /root/.zsh_plugins.sh \ + && antibody bundle zsh-users/zsh-syntax-highlighting >> /root/.zsh_plugins.sh \ + && antibody bundle romkatv/powerlevel10k >> /root/.zsh_plugins.sh -# Default command for better interactive experience -CMD ["/bin/bash"] +CMD ["/bin/zsh"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f098348..9c74bd8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,16 +1,32 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile { - "name": "Existing Dockerfile", - "image": "ghcr.io/elixir-journey/elixir-kickoff:latest" - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - // Uncomment the next line to run commands after the container is created. - // "postCreateCommand": "cat /etc/os-release", - // Configure tool-specific properties. - // "customizations": {}, - // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "devcontainer" -} \ No newline at end of file + "name": "Elixir Kickoff Development Container", + "image": "ghcr.io/elixir-journey/elixir-kickoff:latest", + "remoteEnv": { + "MIX_ENV": "dev" + }, + "customizations": { + "vscode": { + "extensions": [ + "jakebecker.elixir-ls", + "ms-azuretools.vscode-docker", + "editorconfig.editorconfig", + "eamodio.gitlens", + "streetsidesoftware.code-spell-checker", + "esbenp.prettier-vscode", + "pkief.material-icon-theme" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + } + } + }, + "postCreateCommand": "mix deps.get", + "postStartCommand": "/bin/sh /workspace/.devcontainer/scripts/post_start.sh", + "mounts": [ + "source=${localWorkspaceFolder},target=/workspace,type=bind", + "source=${localEnv:HOME}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached", + "source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind,consistency=cached", + "source=${localEnv:HOME}/.p10k.zsh,target=/root/.p10k.zsh,type=bind,consistency=cached" + ], + "workspaceFolder": "/workspace" +} diff --git a/scripts/post_start.sh b/.devcontainer/scripts/post_start.sh similarity index 100% rename from scripts/post_start.sh rename to .devcontainer/scripts/post_start.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..34d06ee --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +# Elixir build files +/_build +/deps + +# Node.js build files (if applicable) +node_modules + +# Editor and OS files +*.swp +*.swo +*.log +.DS_Store + +# Git ignored files +.git