Browse Source

Merge pull request #2 from alaurie/revert-1-pr-709-devcontainer-tweaks

Revert "Several tweaks to #709"
pull/709/head
Alex Laurie 5 months ago
committed by GitHub
parent
commit
f80f85df71
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      .devcontainer/Dockerfile
  2. 22
      .devcontainer/devcontainer.json

13
.devcontainer/Dockerfile

@ -16,20 +16,13 @@ RUN dnf update -y && \
# Set up arguments for Hugo installation
ARG HUGO_VERSION=latest
ARG HUGO_VARIANT=hugo_extended
ARG WORKSPACE_DIR
# Download and install Hugo
RUN if [ "$HUGO_VERSION" = "latest" ]; then \
HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}'); \
fi && \
ARCH=$(uname -m) && \
case "$ARCH" in \
"x86_64") HUGO_ARCH="64bit";; \
"arm64"|"aarch64") HUGO_ARCH="arm64";; \
*) echo "Unsupported architecture: $ARCH" && exit 1;; \
esac && \
echo "Installing Hugo version: ${HUGO_VERSION}" && \
wget -O hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_VARIANT}_${HUGO_VERSION}_Linux-${HUGO_ARCH}.tar.gz && \
wget -O hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_VARIANT}_${HUGO_VERSION}_Linux-64bit.tar.gz && \
tar -xzf hugo.tar.gz && \
mv hugo /usr/local/bin/hugo && \
chmod +x /usr/local/bin/hugo && \
@ -50,8 +43,8 @@ USER vscode
# Expose port for Hugo server
EXPOSE 1313
# Set the working directory to the container workspace directory
WORKDIR ${WORKSPACE_DIR}
# Set the working directory
WORKDIR /workspace
# Set the default command to run Hugo server
CMD ["hugo", "server", "--bind=0.0.0.0"]

22
.devcontainer/devcontainer.json

@ -1,14 +1,13 @@
{
"name": "AlmaLinux_WWW_Container",
"overrideCommand": false,
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "hugo",
"VERSION": "latest",
"WORKSPACE_DIR": "${containerWorkspaceFolder}"
"VERSION": "latest"
}
},
"customizations": {
"vscode": {
"extensions": [
@ -17,19 +16,10 @@
"esbenp.prettier-vscode",
"yzhang.markdown-all-in-one",
"tamasfe.even-better-toml"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash",
"icon": "terminal-bash"
}
}
}
}
]
},
"terminal.integrated.shell.linux": "/bin/bash"
},
"forwardPorts": [1313],
"remoteUser": "vscode",
"postCreateCommand": "echo 'function git_branch() { local branch; branch=\"$(git symbolic-ref --short HEAD 2> /dev/null)\"; if [[ -n \"$branch\" ]]; then echo -n \"$branch\"; return 0; fi; return 1; } && function git_has_changes() { git diff --quiet HEAD 2> /dev/null || echo -n \"✗\"; } && export WHITE=\"\\[\\033[1;37m\\]\" && export GREEN=\"\\[\\033[0;32m\\]\" && export BLUE=\"\\[\\033[0;94m\\]\" && export RED=\"\\[\\033[1;31m\\]\" && export YELLOW=\"\\[\\033[1;33m\\]\" && export RESET=\"\\[\\033[0m\\]\" && function prompt_command() { PS1=\"${GREEN}\\u${WHITE} ➜ ${BLUE}\\w ${BLUE}(${RED}\\$(git_branch)${YELLOW}\\$(git_has_changes)${BLUE})${RESET}$ \"; } && export PROMPT_COMMAND=\"prompt_command\"' >> ~/.bashrc"
"remoteUser": "vscode"
}

Loading…
Cancel
Save