Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Docker image #12885

Open
jmooring opened this issue Sep 27, 2024 · 2 comments
Open

Improve Docker image #12885

jmooring opened this issue Sep 27, 2024 · 2 comments

Comments

@jmooring
Copy link
Member

jmooring commented Sep 27, 2024

The purpose of this issue is to solicit community feedback and hopefully reach some consensus.

As of v0.135.0 I can do things like1:

docker run -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 config
docker run -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 env
docker run -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 list all
docker run -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 new foo.md
docker run -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 server

But I can't build the site like this:

docker run -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 

Instead, I have to pass an empty entry point:

docker run --rm -v .:/site -u $(id -u):$(id -g) --entrypoint "" ghcr.io/gohugoio/hugo:v0.135.0 hugo

Or pass in a CLI flag to override the default --help flag defined in the Dockerfile. For example:

docker run --rm -v .:/site -u $(id -u):$(id -g) ghcr.io/gohugoio/hugo:v0.135.0 --minify

Additionally, the current version:

  1. Is not the extended version
  2. Does not support Hugo modules
  3. Does not support AsciiDoc, Pandoc, or reStructuredText (which is probably fine)
  4. Does not support PostCSS
  5. Does not support GitInfo
  6. Does not write to host cache directory (cacheDir / HUGO_CACHEDIR / os.CacheDir)
  7. I'm not sure if css.TailwindCSS works

Now that we can build an image, it would be good to define what we actually want it to do.

Some time ago I created a repo to test docker images:
https://github.com/jmooring/hugo-docker-test

Our Docker image doesn't need to pass that test, but we should consider what we want to support:
https://github.com/jmooring/hugo-docker-test?tab=readme-ov-file#site-characteristics

There's an open issue about how to document usage:
gohugoio/hugoDocs#2727

Footnotes

  1. The -u $(id -u):$(id -g) flag is required to set correct permissions on published files. Without this, owner and group were set to root during my Linux testing.

@bep
Copy link
Member

bep commented Sep 27, 2024

So, the image will need to be able to build a Hugo site. If that's not the case, please create a bug, but I'm not taking improvement requests for this particular feature. It was supposed to be a simple thing and we have already spent hundreds of hours on it.

@jmooring I'm closing this, create a new bug track the actual bug.

If the image as it is is not useful, lets just remove it. We don't have the budget to maintain all the bells and whistles.

@bep bep closed this as completed Sep 27, 2024
@bep
Copy link
Member

bep commented Sep 28, 2024

I'm reopening this, the timing of this got me a little grumpy. We have spent a stupid amount of time just getting the build setup working, and I kind of assumed that the people who started that process found the Docker image we've had living in the project for years both working and useful.

That said, I'm already maintaining 2 complex Docker files for the Hugo build, I'm not adding another to that plate, so let us focus on the "getting it in a working state",.

@bep bep reopened this Sep 28, 2024
@bep bep removed the NeedsTriage label Sep 28, 2024
@bep bep added this to the Unscheduled milestone Sep 28, 2024
bep added a commit that referenced this issue Oct 9, 2024
* Add tzdata (needed by Hugo)
* add ldflags
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 10, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Build the extended version by default
* Add "npm ci" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 10, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 10, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 10, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 10, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 10, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 11, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
bep added a commit that referenced this issue Oct 13, 2024
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants