Skip to content

Commit

Permalink
Feat: Devcontainer with Jekyll + Compiler theme (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman authored Dec 17, 2024
2 parents d541650 + 39905f5 commit 096feac
Show file tree
Hide file tree
Showing 16 changed files with 570 additions and 3 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:3.12

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
USER=compiler

RUN useradd --create-home --shell /bin/bash $USER && \
chown -R $USER /home/$USER

WORKDIR /home/$USER/site

RUN apt-get update
RUN apt-get install -y ruby-full && gem install bundler
RUN python -m pip install --upgrade pip
COPY Gemfile Gemfile
#COPY Gemfile.lock Gemfile.lock
RUN bundle install

COPY .devcontainer/requirements.txt .devcontainer/requirements.txt
RUN pip install --no-cache-dir -r .devcontainer/requirements.txt

USER $USER
ENV PATH "$PATH:/home/$USER/.local/bin"
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/jekyll
{
"name": "compilerla/compilerla.github.io",
"dockerComposeFile": "../compose.yml",
"service": "site",
"workspaceFolder": "/home/compiler/site",
"postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
}
},
"extensions": [
"eamodio.gitlens",
"esbenp.prettier-vscode",
"mhutchie.git-graph",
"redhat.vscode-xml",
"sissel.shopify-liquid"
]
}
}
}
7 changes: 7 additions & 0 deletions .devcontainer/postAttach.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eu

git config --global --add safe.directory /home/compiler/site

# initialize hook environments
pre-commit install --install-hooks --overwrite
1 change: 1 addition & 0 deletions .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pre-commit
4 changes: 2 additions & 2 deletions .github/workflows/site-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Deploy Preview to Netlify
run: |
netlify deploy \
--alias="${GITHUB_REPOSITORY#*/}-${{ github.event.number }}" \
--alias="compiler-docs-${{ github.event.number }}" \
--auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \
--dir="_site" \
--site=${{ vars.NETLIFY_PREVIEW_APP_SITE_ID }}
Expand All @@ -56,5 +56,5 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Preview url: https://${context.repo.repo}-${{ github.event.number }}--${hostnameSuffix}`,
body: `Preview url: https://compiler-docs-${{ github.event.number }}--${hostnameSuffix}`,
})
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ci:
autofix_commit_msg: "chore(pre-commit): autofix run"
autoupdate_commit_msg: "chore(pre-commit): autoupdate hooks"

default_install_hook_types:
- pre-commit
- commit-msg

repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: check-yaml
args: ["--unsafe"]
- id: check-added-large-files
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 130
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.encoding": "utf8",
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"files.associations": {
"*.html": "liquid"
},
"[liquid]": {
"editor.formatOnSave": true
}
}
27 changes: 27 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Jekyll: Build Dev",
"detail": "jekyll serve --force_polling --livereload",
"type": "shell",
"linux": {
"command": "bundle exec jekyll serve --force_polling --livereload"
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
]
}
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem "github-pages", "~> 232", group: :jekyll_plugins
Loading

0 comments on commit 096feac

Please sign in to comment.