Contents

Cloud Workstation With Hugo Env

The preconfigured base images provided by Cloud Workstations contain only a minimal environment with IDE, basic Linux terminal and language tools and a sshd server. To expedite the environment setup of specific development use cases, you can create custom container images that extend these base images to pre-install tools and dependencies and that run automation scripts.

Base container image provided by Cloud Worksation

ImageDescription
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latestCloud Workstations base editor based on Code-OSS. (Default).
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/base:latestBase image with no IDE installed.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/clion:latestCLion IDE. Accessible only through JetBrains Gateway
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/goland:latestGoLand IDE. Accessible only through JetBrains Gateway.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/intellij-ultimate:latestIntelliJ IDEA Ultimate IDE. Accessible only through JetBrains Gateway.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/phpstorm:latestPhpStorm IDE. Accessible only through JetBrains Gateway.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/pycharm:latestPyCharm Professional IDE. Accessible only through JetBrains Gateway.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/rider:latestRider IDE. Accessible only through JetBrains Gateway.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/rubymine:latestRubyMine IDE. Accessible only through JetBrains Gateway.
us-central1-docker.pkg.dev/cloud-workstations-images/predefined/webstorm:latestWebStorm IDE. Accessible only through JetBrains Gateway.

Hugo env

Build Hugo development environment by GCP cloud workstation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM us-central1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latest

RUN sudo apt update
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
ARG VARIANT=hugo
# VERSION can be either 'latest' or a specific version number
ARG VERSION=latest

# Download Hugo
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
    rm -rf /var/lib/apt/lists/* && \
    case ${VERSION} in \
    latest) \
    export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
    esac && \
    echo ${VERSION} && \
    wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-64bit.tar.gz && \
    tar xf ${VERSION}.tar.gz && \
    mv hugo /usr/bin/hugo

# Download Extension
RUN wget https://open-vsx.org/api/bungcip/better-toml/0.3.2/file/bungcip.better-toml-0.3.2.vsix && \
unzip bungcip.better-toml-0.3.2.vsix "extension/*" &&\
mv extension /opt/code-oss/extensions/better-toml

RUN wget https://open-vsx.org/api/DavidAnson/vscode-markdownlint/0.48.1/file/DavidAnson.vscode-markdownlint-0.48.1.vsix && \
unzip DavidAnson.vscode-markdownlint-0.48.1.vsix "extension/*" &&\
mv extension /opt/code-oss/extensions/markdownlint

RUN wget https://open-vsx.org/api/wmaurer/change-case/1.0.0/file/wmaurer.change-case-1.0.0.vsix && \
unzip wmaurer.change-case-1.0.0.vsix "extension/*" &&\
mv extension /opt/code-oss/extensions/change-case

# Hugo dev server port
EXPOSE 1313

# [Optional] Uncomment this section to install additional OS packages you may want.
#
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y install --no-install-recommends webp
1
$ docker build -t cage1016/hugo-evn .

Workstation

  1. Setup workation base container image at workstation configuration docker.io/cage1016/hugo-env:latest configuration

  2. We could let Service Account field empty if base container image is public.

  3. Create workstation by previous configuration create workstation

  4. Start workstaion and luanch it. start workstation

  5. Clone git repo from https://github.com/526avijitgupta/gokarna.git clone repo

  6. Develop Hugo

    $ cd exampleSite/

    $ hugo server -D

    clone repo
  7. We need to enable gcloud cli port-forward for local live preview gcloud port forward

  8. Visit http://localhost:1313

  9. Enjoying Hugo development.

    /posts/cloud-workstation-with-hugo-env/img/placeholder.gif