fixed devcontainer, ref #128

This commit is contained in:
Somrat 2024-05-26 11:02:20 +06:00
parent 7c177108db
commit 224672b041
2 changed files with 27 additions and 25 deletions

View File

@ -1,33 +1,36 @@
# Update the arg in docker-compose.yml or devcontainer.json to switch arg versions
ARG NODE_VERSION=18
# Use an official node image as a parent image
FROM node:20
# main image
FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_VERSION}
# Set environment variables for versions
ARG HUGO_VERSION=0.126.1
ARG GO_VERSION=1.22.3
# Update the arg in docker-compose.yml or devcontainer.json to switch arg versions
ARG GO_VERSION=latest
ARG HUGO_VERSION=latest
# Install dependencies
RUN apt-get update && \
apt-get install -y ca-certificates openssl git curl && \
rm -rf /var/lib/apt/lists/*
# Download necessary tools
RUN apt-get update && apt-get install -y \
ca-certificates openssl git curl && \
rm -rf /var/lib/apt/lists/* && \
# set architecture
case $(uname -m) in \
aarch64) \
export ARCH=arm64 ;; \
*) \
export ARCH=amd64 ;; \
esac && \
# install Hugo
# Determine architecture
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; else ARCH=amd64; fi && \
echo "Architecture: $ARCH"
# Download and install Hugo
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; else ARCH=amd64; fi && \
wget -O hugo_extended_${HUGO_VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${ARCH}.tar.gz && \
tar xf hugo_extended_${HUGO_VERSION}.tar.gz && \
mv hugo /usr/bin/hugo && \
rm hugo_extended_${HUGO_VERSION}.tar.gz && \
# install Go
echo "Hugo installed"
# Download and install Go
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; else ARCH=amd64; fi && \
wget -O go${GO_VERSION}.linux-${ARCH}.tar.gz https://dl.google.com/go/go${GO_VERSION}.linux-${ARCH}.tar.gz && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-${ARCH}.tar.gz && \
rm go${GO_VERSION}.linux-${ARCH}.tar.gz
rm go${GO_VERSION}.linux-${ARCH}.tar.gz && \
echo "Go installed"
# Export Go path
ENV PATH=$PATH:/usr/local/go/bin

View File

@ -3,9 +3,8 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"NODE_VERSION": "20",
"GO_VERSION": "1.21.4",
"HUGO_VERSION": "0.120.4"
"GO_VERSION": "1.22.3",
"HUGO_VERSION": "0.126.1"
}
},
"customizations": {