Code Monkey home page Code Monkey logo

docker-hugo's People

Contributors

dchesterton avatar espadav8 avatar euantorano avatar jakejarvis avatar jbergler avatar klakegg avatar kusha avatar selfsimilar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-hugo's Issues

certificate signed by unknown authority bug when self-hosting hugoDocs

I spent a few days trying to get hugo with extensions to compile and run in alpine linux...but finally gave up (would get periodic segfaults!! but sometimes it ran okay). Your docker builds solve that problem, (I'm guessing that's the reason for the FROM frolvlad/alpine-glibc:alpine-3.7?) so thanks, and great work.

However, I just came across a bug trying to self-host the hugoDocs website.

To reproduce, clone the hugoDocs site, then do:

james at laptop in ~/repos/hugo_related/hugo/hugoDocs on master
$ docker run --rm -it -v $(pwd):/src -v $(pwd)/public:/target --name hugodocs -p 1314:1313 klakegg/hugo:0.49-ext-pandoc server 
Building sites … ERROR 2018/10/16 16:03:53 Failed to get JSON resource https://api.twitter.com/1/statuses/oembed.json?id=962380712027590657&dnt=false: Get https://api.twitter.com/1/statuses/oembed.json?id=962380712027590657&dnt=false: x509: certificate signed by unknown authority
...

(ah, note that I'm exposing 1313 to 1314 externally because I'm running my dev blog on 1313...)

To solve, I copied your alpine ext Dockerfile and then added

RUN apk add --no-cache libstdc++ \
	ca-certificates

With that change, hosting the hugoDocs website works:

james at laptop in ~/repos/hugo_related/hugo/hugoDocs on master
$ docker run --rm -it  -e HUGO_BIND="0.0.0.0"  -e HUGO_PUBLISHDIR=/target   --user 1000 -p 1314:1313  -v ${PWD}:/home  --name hugodocs  -v ${PWD}/public:/target  jmarca/hugo server

                   | EN  | ZH   
+------------------+-----+-----+
  Pages            | 540 |  23  
  Paginator pages  |   1 |   0  
  Non-page files   |  41 |   0  
  Static files     | 166 | 166  
  Processed images |  90 |   0  
  Aliases          |  15 |   4  
  Sitemaps         |   2 |   1  
  Cleaned          |   0 |   0  

Total in 1193 ms
Watching for changes in /home/{content,data,layouts,static,themes}
Watching for config changes in /home/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

I think this will have to be done in the final images in your setup, since the ca-certs might be different in busybox/alpine/ubuntu/etc. So no pull request from me, as it seems like something for you to decide where to put it best.

(I also fiddled with a few other things in the Dockerfile, which is why the source is /home, --user is 1000, etc...but those aren't bugs)

Tag 0.91.0-asciidoctor fails to execute asciidoctor

Previous versions seem to work perfectly

Output:

hugo v0.91.0-D1DC0E9A linux/amd64 BuildDate=2021-12-17T09:50:20Z VendorInfo=gohugoio
Error: Error building site: "/src/content/footprint/F2/F2.3.adoc:1:1": access denied: "asciidoctor" is not whitelisted in policy "security.exec.allow"; the current security configuration is:

[security]
  enableInlineShortcodes = false
  [security.exec]
    allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']
    osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$']

  [security.funcs]
    getenv = ['^HUGO_']

  [security.http]
    methods = ['(?i)GET|POST']
    urls = ['.*']


Total in 2276 ms```

Issues with pandoc vs pandoc-default?

Thanks for this great set of Docker images!

I've been having some issues getting this work correctly with pandoc. (Pandoc is specified in the front matter with markup: pandoc, and I only need the default mathjax flag.)

$ docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:0.81.0-ext-pandoc server
Start building sites …
pandoc not found in $PATH: Please install.
                  Leaving pandoc content unrendered.

It seems that this is an issue with pandoc-default vs pandoc. Hugo is looking directly for pandoc, and the pandoc alias doesn't seem to work because it isn't on the PATH for Hugo to pick up.

For now, I've been able to solve the problem by adding a symlink from pandoc-default to pandoc. Here's the relevant snippet of my working GitLab configuration (which uses 0.77.0, but had the same issue):

image: klakegg/hugo:0.77.0-ext-pandoc-ci

pages:
  stage: deploy
  script:
    - ln -s /bin/pandoc-default /bin/pandoc
    - hugo -D

Am I using this correctly? Thank you for any suggestions you might have!

`apt update` fails on ext-ubuntu

The deb.nodesource.com HTTPS certificate is not trusted by the image:

$ apt update
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Ign:2 https://deb.nodesource.com/node_14.x bionic InRelease
Err:3 https://deb.nodesource.com/node_14.x bionic Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 23.62.230.72 443]
Get:4 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2365 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1430 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [606 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [26.7 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2800 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2208 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [34.4 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [638 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [11.3 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [11.4 kB]
Reading package lists...
E: The repository 'https://deb.nodesource.com/node_14.x bionic Release' does not have a Release file.

Running apt install ca-certificates (which upgrades the package from 20210119~18.04.1 to 20210119~18.04.2) fixes it.

0.83.1 release

Hi there! Thanks a lot for your image, it is way more convenient for me to use yours instead of building my own.

Apologies for bothering you with such a small thing but would you be so kind as to build 0.83.1? It brought webp support and a new section param in the post URL, and I would love to be able to use these in production.

Cannot build site using Jenkins and docker image

Hello, I'm trying to build my website with Jenkins and your docker image and have following error:

/var/jenkins_home/workspace/srcdir
+ mkdir output
+ ls
Jenkinsfile
archetypes
build.sh
config.toml
content
output
static
themes
+ pwd
+ pwd
+ docker run --rm -v /var/jenkins_home/workspace/srcdir:/src -v /var/jenkins_home/workspace/srcdir/output:/target klakegg/hugo:debian
Error: Unable to locate Config file. Perhaps you need to create a new site.
       Run `hugo help new` for details.

Tried hugo:debian and hugo:latest - same error.

Where I failed?

No support for modules?

I have a Hugo site that imports a theme with Go modules. The docker-hugo container results in an error during build stating: "Error: we found a a go.mod file in your project, but you need to install Go to use it." Not sure if this is by design.

Provide Git binary

The Git binary is used for enableGitInfo = true in the hugo config.
Themes commonly use this for "last modified" metadata and linking to commits on GitHub.

Missing this binary results in:

$ docker run --rm -tiv `pwd`:/src klakegg/hugo:0.55.6-ext
Building sites … ERROR 2019/08/06 19:09:33 Failed to read Git log: Git executable not found in $PATH

docker tags with prefix 0.72.0 are not on docker.io

Hi,

Following the updated of hugo to 0.72.0 i wanted to updated my docker containers. However on docker hub there are only updated versions available without the 0.72.0 prefix (iow edge-ext-alpine but not 0.72.0-ext-alpine)

Perhaps i am overlooking something?

Which OS to choose?

Thanks for making and maintaining all these docker images, it looks like a lot of work.

I'm curious what the difference is between Busybox, Alpine, Debian, and Ubuntu. Which of these to choose?

I Googled of course before opening this issue, and I learned that Busybox is the smallest, which sounds good. But I also learned that Alpine is fast and secure. But not always, because certain applications are up to 50x slower. So perhaps Debian is better, although Ubuntu has better development behind it I learned.

I suppose that picking the right one is quite important, else you wouldn't have gone through the trouble of making 4 different ones.

But I don't really know what's best to run Hugo on. 😄 Does anyone has an insight into that?

My use case is to run the Hugo (extended version) docker with continuous deployment (CircleCI).

more doc needed

After running this command

docker run --rm -it -v $(pwd):/src -v $(pwd)/output:/target klakegg/hugo:0.46

got below error

Error: Unable to locate Config file. Perhaps you need to create a new site.
       Run `hugo help new` for details.

i am not sure if the /src folder mounted from host need files there already
i am just looking to get started with hugo with docker and not sure if there are needed files or pre-requisites before running the docker commands in the README file

Will be great if you can add some more info in readme for people getting started with hugo with docker

Signals are not sent to the hugo process

Since the hugo process is not PID 1 in the container, signals send to the container are lost. This makes stopping the container a bit slow. See https://docs.docker.com/compose/#why-do-my-services-take-10-seconds-to-recreate-or-stop

There are a few solutions:

More info at https://hynek.me/articles/docker-signals/

Thanks for your work!

Add rest2html binary to images

Hi!

I love your Docker images and I used daily. But I would like to use ReStructuredText and I can't build my Hugo site because when I try to do it your image misses rst2html.

May you add rst2html to your images?

Thank you!

Contributing towards hugo official docker images

Hugo is a great candidate to be integrated in a CI/CD pipeline and this is the reason why your docker images are great to me. It seems that they are not only great to me but also to hugo people (https://gohugo.io/getting-started/installing/#docker) because they recommend yours...

I was wondering if they were open to contribution towards an official image of hugo or if you will be willing to collaborate towards one.

From users point of view, this would mean using official images instead of third party ones which seems to boost confidence on security. For developers this would mean more focused efforts towards a common goal, reducing duplicate efforts. For the hugo project this may mean key tech support that enables their product to be even be more desirable for lazy people like me!

Please, excuse me if I am stepping out of my bounds. I hope this is not taken as something bad but comes from recognizing a good quality of the work you have done.

Thanks

TOCSS: failed to transform

Can not build sass assets with this docker image.

How to reproduce

  1. Login to the docker image
docker run --rm -it \
  -v $(pwd):/src \
  -w="/src" \
  klakegg/hugo:0.72.0-alpine \
  shell
  1. Remove resources
    hugo:/src$ rm -rf public/ resources/

  2. Serve

hugo:/src$ hugo serve
Error: Error building site: TOCSS: failed to transform "sass/jane.scss" (text/x-scss): resource "scss/sass/jane.scss_48b060fe05b0a273d182ef83c0605941" not found in file cache

But if I do this without docker image and directly in my host machine - everything is ok.

rm -rf public/ resources/;
hugo serve      

Works fine.

The version of Hugo in the docker image:

Hugo Static Site Generator v0.72.0-8A7EF3CF linux/amd64 BuildDate: 2020-05-31T12:07:45Z

The version of Hugo in the host PC:

Hugo Static Site Generator v0.72.0/extended darwin/amd64 BuildDate: unknown

Bump Node version

The most recent LTS version of NodeJS is 16.x, but docker-hugo currently builds NodeJS 14.x. I'm not sure if it makes more sense to just bump to most recent LTS across the board, or make it a build option. I don't know how to do either, but I'm going to try to at least build this with latest NodeJS LTS. Happy to turn this into a pull request if successful.

Hugo modules don't work - golang missing

Running site generation using this image:

docker run --rm -v "`pwd`":/src -v "`pwd`/site-pages":/target klakegg/hugo:0.67.1-ext-alpine --source="/src/exampleSite" --destination="/target" --ignoreCache

I get

Error: we found a go.mod file in your project, but you need to install Go to use it

Can you please add golang installation in the base docker image?
thanks

`Error: unknown command "sh" for "hugo"`

I am using this container for GitLab Pages. No matter what I specify to be run as a script, whether it's hugo or echo hello, I am greeted with this error message:

Error: unknown command "sh" for "hugo"
Run 'hugo --help' for usage.
Error: unknown command "sh" for "hugo"
Run 'hugo --help' for usage.

Notice it happens twice, that is not a copying error. I am unable to determine what is causing this. If I use other containers available for hugo from Docker Hub, it is successful. That must mean this container is what's causing the problem.

The problem persists despite changing the image. For example, I have tried alpine, latest, and debian to no avail. Same problem each time. I am willing to post my .gitlab-ci.yml if it is wanted, but I wasn't sure if it was relevant.

Public directory not created

When I run hugo -D in these containers the public directory never is created (same for ubuntu and ubuntu-onbuild).

What am I not understanding?

$ docker run --rm -it -v $PWD:/source --entrypoint /bin/bash klakegg/hugo:ubuntu-onbuild
$ cd /source
$ hugo -D
Building sites … WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.


                   | EN  
-------------------+-----
  Pages            | 26  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     | 19  
  Processed images |  0  
  Aliases          | 12  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 25 ms
$ ls -alh public
ls: cannot access 'public': No such file or directory

NPM install

For use with TailwindCSS, one needs to install an NPM package before running hugo.
So I have a relevant package.json in my hugo folder next to the Dockerfile.

The current Dockerfiles ignore the package.json.

Is there an easy way to hook the npm install command in an onbuild image use?

klakegg/hugo:ext-alpine libstdc++.so.6 symbol not found

Hi,
Having some troubles with getting to work klakegg/hugo:ext-alpine with asciidoctorjs from npm on gitlab

it was always finalized with:

npm i -g --save asciidoctor
Error relocating /usr/lib/libstdc++.so.6: __fprintf_chk: symbol not found
Error relocating /usr/lib/libstdc++.so.6: __strftime_l: symbol not found
Error relocating /usr/lib/libstdc++.so.6: __cxa_thread_atexit_impl: symbol not found
Error relocating /usr/lib/libstdc++.so.6: __sprintf_chk: symbol not found
Error relocating /usr/bin/node: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/bin/node: _ZNSt19_Sp_make_shared_tag5_S_eqERKSt9type_info: symbol not found
Error relocating /usr/bin/node: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found

my only solution is now:

  before_script:  
  - apk del libstdc++
  - set -x && apk add --force-overwrite --no-cache --update libc6-compat libstdc++
  - /usr/glibc-compat/sbin/ldconfig

It is strange because you can't install libc6-compat only, you also need to remove then install with force both libc6-compat and libstdc++.

herei is full build stage:

build:
  stage: build
  image: 
    name: klakegg/hugo:ext-alpine
    entrypoint: [""]
  tags: 
  - docker
  #- private
  before_script:  
  - apk del libstdc++
  - set -x && apk add --force-overwrite --no-cache --update libc6-compat libstdc++
  - /usr/glibc-compat/sbin/ldconfig
  script:
  - hugo version
  - git submodule update --init --recursive
  - apk add npm
  - npm i -g --save asciidoctor
  - npm i -g --save @asciidoctor/core
  - npm i -g --save asciidoctor-kroki asciidoctor-html5s
  - mv /usr/bin/asciidoctor /usr/bin/asciidoctor_org
  - printf '#!/bin/sh\n# This is a bash comment inside the script \n/usr/bin/asciidoctor_org -r asciidoctor-kroki -r asciidoctor-html5s -b html5  -a kroki-fetch-diagram=true -a icons=font "$@"\n' > /usr/bin/asciidoctor
  - chmod 775 /usr/bin/asciidoctor
  - hugo -v -D --destination ./public
  artifacts:
    paths:
    - public
  only:
  - master

Is there more elegant solution ?

Typo in `onbuild` environment variables?

I tried to use the onbuild tag for my personal blog today and noticed that I had to set the environment variable HUGO_DESTINATION instead of HUGO_DESTINATION_ARG to switch the output folder to my volume.

Is this a typo in the README or did I miss some other configuration for the onbuild? 🤔

Feature request: rsync

Is it possible to include rsync in one of the variants?

I'm trying to use the image to build a bitbucket repository, and then push the result into a server using rsync+ssh.

Docker fails on building a hugo theme "academic"

Bug description

This error relates to a hugo theme, but since I get the error only in docker I am asking here.

When I run hugo on the template website of hugo/academic I get the following error:

Building sites … ERROR 2020/05/26 16:39:01 render of "page" failed: "/app/site/themes/academic/layouts/publication/single.html:14:10": execute of template failed: template: publication/single.html:14:10: executing "main" at <(.Params.publication_types) and (ne (index .Params.publication_types 0) "0")>: can't give argument to non-function .Params.publication_types

There are no errors outside of docker.

Steps to reproduce

Create a Dockerfile with the following content:

FROM klakegg/hugo:ext-ubuntu

RUN apt-get update && apt-get install -y bash git

# Setup Hugo envrionment
WORKDIR /app
RUN mkdir -p /app/site \
    && git clone https://github.com/sourcethemes/academic-kickstart.git /app/site \
    && cd site \
    && git submodule update --init --recursive \
    && cp -av /app/site/themes/academic/exampleSite/* /app/site

WORKDIR /app/site

Build the docker image with docker build -t test/hugo .

Run the docker image with docker run --rm test/hugo

Versions

hugo 0.71.1

ARM-based docker images

Hi! Thank you for the very updated docker images for Hugo.

Is there any plan to produce ARM-based docker images?

Create hugo-unprivileged image

@klakegg do you have any interest in me contributing an unpriviledged Dockerfile?

Similar to: https://hub.docker.com/r/nginxinc/nginx-unprivileged

This is mainly to deal with corporate security and allow the hugo container to run in environments that prevent running as root. I am using your image for https://github.com/jimangel/GitDocs and 2 of the 3 images don't run as root.

Alternately, if you don't have interest in adding this build, would you be willing to share your build process (triggers) and I could fork / maintain? Thanks!

Please add another syntax highlighters

Thank you for providing such a helpful image.

Could you please consider adding pygments or rouge to this image?

I'm using Hugo and AsciiDoc to create a site.
AsciiDoctor supports the following code highlighters.

  • highlightjs
  • pygments
  • rouge
  • coderay

This image contains coderay, which doesn't support as many languages as the other highlighters. For example, coderay cannot highlight C# or PowerShell, which I would like to use.
So, I would like to use pygments or rogue.

Thank you very much.

Using Private Hugo module in Gitlab during Docker image building

Trying to use Hugo modules (Go Module) from Privates repository. Seems like Hugo needs credentials to download the private Hugo module during build/serve which causes following step in Dockerfile fail.

FROM klakegg/hugo:0.74.3-onbuild AS hugo

May there should be a way to run below type of command before the hugo build starts

git config \
    --global \
    url."https://${bitbucket_id}:${bitbucket_token}@privatebitbucket.com/".insteadOf \
    "https://privatebitbucket.com/"

Ref: https://medium.com/cloud-native-the-gathering/go-modules-with-private-git-repositories-dfe795068db4

Unable to locate config file or config directory

Appreciate your work.

I find this project and try to generate my site, but I always get this error:

Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
Run hugo help new for details.

The working directory have the following directory structure:

config.toml
README.md
├── archetypes
├── content
├── docker-compose
├── public
├── resources
├── static
└── themes

And the command I issue in the command line is: docker run --rm -it -v $(pwd):/src klakegg/hugo:0.74.1

As you can see , there is indeed the config file named config.toml, so I don't know why this error keeps happening.

Thanks for your time reading this, and help is needed, tks !

build as production, extended hugo required?

I'm new to the topic, but wanted to share anyway, maybe it's an error on my side.

I tried to deploy a hugo site with onbuild-busybox with ananka theme as described in hugo quickstart

When i add --build-arg=HUGO_ENV_ARG=production i get a build failure indicating extended version is required to build scss files (probably originate from ananka theme).

Is there a build option to build the extended version, should i not use themes with scss, or something else failing here?

Run Docker as non root

Is there a way to run the container as non-root user? I might be stupid but I tried setting up PUID and PGID but it keeps running as root and creating directory owner and group as root.

Thanks

How to set environemnt when using onbuild images? Currently I can't

Hi,

We are building a website with onbuild.

How can we have a multi-stage docker build and we can't set the the HUGO_ENV value to somethings else during the build phase.

# Stage 1 - build the website
FROM klakegg/hugo:0.62.2-ext-debian-onbuild as website_build

# The environment changes what config files are used.
# See https://gohugo.io/getting-started/configuration/#configuration-directory
# and https://github.com/klakegg/docker-hugo#configuration

# <<<<< does not work ?! 
ENV HUGO_ENV production

# Stage 2 - build the actual image
FROM nginx:stable

# Copy actual website over the rest of the resources
# https://github.com/klakegg/docker-hugo#using-an-onbuild-image
COPY --from=website_build /onbuild /usr/share/nginx/html

RUN cat /usr/share/nginx/html/index.html - uses old configuration ?!
tree config 
config
├── beta
│   └── config.toml
├── _default
│   └── config.toml
└── production
    └── config.toml


Production config.toml

cat config/production/config.toml 
baseURL = "https://www.production.com"% 

AllI see is the URL for default, not the production URL.

I think that this could work if HUGO_ENV is initialized from HUGO_ENV ARG by default and we can suuply the HUGO_ENV build arg during image build.

Multistage build usage issue?

I'm trying to use this image in a multistage way.

So, the first lines of the docker files looks like this.

FROM klakegg/hugo:0.66.0 
WORKDIR /src
COPY src/. .
RUN hugo
RUN ls /target

but if I list the /target directory is empty.

If I enter into a container

docker run -it --entrypoint "/bin/sh"  %image_id%

and run hugo, I the files are generated.

The idea is host the output in an ngix but build the site in a single dockerfile. So, the next stages could look like this.

FROM /nginx
WORKDIR /usr/share/nginx/html/
COPY --from=0 /target .

But I can't copy nothing from the target directory.

Any idea?

Owning the site output

Total Docker newbie here, hope you'll help me out.

Using this image with

$ docker run --rm -it -v "$SRC_PATH":/src -v "$TARGET_PATH":/target klakegg/hugo:0.51

I end up with a $TARGET_PATH folder owned by root, since Docker seems to write files to the shared volume on the host side, using the user/group id of the container user.

Trying to use the --user option, as I've seen suggested in a couple of other places, the container is unable to write to it's /target

$ docker run --rm --user "$(id -u):$(id -g)" -it -v "$SRC_PATH":/src -v "$TARGET_PATH":/target klakegg/hugo:0.51
Building sites … ERROR 2018/11/17 00:46:41 open /target/index.html: permission denied
ERROR 2018/11/17 00:46:41 mkdir /target/tags: permission denied
ERROR 2018/11/17 00:46:41 mkdir /target/tags: permission denied
ERROR 2018/11/17 00:46:41 mkdir /target/tags: permission denied
Total in 3 ms
Error: Error copying static files: chtimes /target/: operation not permitted

Of course this isn't the end of the world, since you could just chown the output, but I'm both lazy and curious as to how this might be worked around.

I did find jguyomard/docker-hugo, which kind of works around the issue by creating a user whoms home directory is set to the shared source folder, which just coincidentally has the same user id as most people using the image. This just seems like kind of a hack in my opinion.

What would be the right way to handle this whole thing?

Onbuild - use submodule

Hi,

I'm trying to use klakegg/hugo:0.70.0-ext-ubuntu-onbuild but my site has the theme as a submodule

I'm getting the below which I think means the submodule hasnt installed.

Error building site: "/src/content/home/publications.md:70:1": failed to extract shortcode: template for shortcode "alert" not found

Do you know a solution?

BUG: unexpected --noTimes ("Error: unknown flag: --noTimes")

There is an issue in file src/files/alpine/bin/hugo

Line

It brokes the behaviour of hugo mod commands.

Here are some output examples:

$ hugo mod clean
Error: unknown flag: --noTimes
...
$ hugo mod get -u github.com/gohugoio/gohugoioTheme
go get --noTimes: package --noTimes is not in GOROOT (/usr/local/lib/go/src/--noTimes)
$ hugo mod tidy
Error: unknown flag: --noTimes
...

I'm running the image with this command:

docker run \
	-it \
	--rm \
	--network host \
	--user=$(id -u):$(id -g) \
	--volume $(pwd):/src \
	--entrypoint /bin/bash \
	klakegg/hugo:0.79.0-ext-alpine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.