Skip to content

Commit

Permalink
devcontainer added
Browse files Browse the repository at this point in the history
  • Loading branch information
arulrajnet committed Dec 27, 2024
1 parent 4bf8692 commit ae68a90
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# docker-compose related
COMPOSE_HTTP_TIMEOUT=180
COMPOSE_PROJECT_NAME=blogdevcontainer
COMPOSE_IGNORE_ORPHANS=true
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG VARIANT="3.12"
FROM mcr.microsoft.com/devcontainers/python:1-${VARIANT}

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
asciidoctor \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ENV PATH="${PATH}:/workspace/.venv/bin"
65 changes: 65 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Pelican Blog",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",
"workspaceFolder": "/workspace",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"pasteImage.basePath": "${projectRoot}/content/assets/images/",
"search.exclude": {
"**/node_modules/**": true,
"**/pelican-plugins": true,
"**/.git": true,
"**/output": true,
"**/outputzip": true,
"**/.venv": true,
"**/attila": true
}
},
"extensions": [
"EditorConfig.EditorConfig",
"bierner.emojisense",
"bierner.markdown-preview-github-styles",
"mushan.vscode-paste-image",
"streetsidesoftware.code-spell-checker",
"svsool.markdown-memo",
"Tyriar.sort-lines",
"yzhang.markdown-all-in-one",
"asciidoctor.asciidoctor-vscode",
"charliermarsh.ruff",
"GitHub.vscode-github-actions"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000],

// Use 'portsAttributes' to set default properties for specific forwarded ports.
// More info: https://containers.dev/implementors/json_reference/#port-attributes
"portsAttributes": {
"8000": {
"label": "My Blog",
"onAutoForward": "notify"
}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/post-create.sh",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
17 changes: 17 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.8'
services:
devcontainer:
image: arulrajnet/vscode-pelican-devcontainer:latest
build:
context: .
dockerfile: Dockerfile
args:
VARIANT: 3.12
volumes:
- ..:/workspace:cached
# Softlink is not working. So mounted from actual location
- ~/Dropbox/workspace/ubuntu_home/.aws:/root/.aws:cached
- ~/Dropbox/workspace/ubuntu_home/.ssh:/root/.ssh:cached
- ~/Dropbox/workspace/ubuntu_home/.gitconfig:/root/.gitconfig:cached
- ~/Dropbox/workspace/ubuntu_home/.gitignore_global:/root/.gitignore_global:cached
command: sleep infinity
16 changes: 16 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -ex

##
## Create some aliases
##
echo 'alias ll="ls -alF"' >> $HOME/.bashrc

WORKSPACE_DIR=/workspace

# Now install all dependencies
pip install .

chmod 600 -R ~/.ssh

echo "Done!"
8 changes: 5 additions & 3 deletions content/pelican-obsidian-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ status: published

This blog post written in Obsidian and published with Pelican.

Used [https://github.com/jonathan-s/pelican-obsidian](pelican-obsidian) plugin to convert Obsidian markdown to Pelican markdown.
Used [pelican-obsidian](https://github.com/jonathan-s/pelican-obsidian) plugin to convert Obsidian markdown to Pelican markdown.

Obsidian is a powerful knowledge base that works on top of a local folder of plain text Markdown files. Here are some key Markdown features in Obsidian:

Expand Down Expand Up @@ -117,12 +117,14 @@ Use backticks for inline code and triple backticks for code blocks.

Multiline code block:

```md
````
```python
def hello_world():
print("Hello, World!")
```
```
````

The output will be:

```python
def hello_world():
Expand Down

0 comments on commit ae68a90

Please sign in to comment.