Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ RUN bundle update \
FROM scratch AS vendor
COPY --from=vendored /out /

# Serve the files using jekyll to enable file watching
# and livereload for a faster inner loop
FROM gem AS dev
CMD ["./dev-start.sh"]

# Build the static HTML for the current docs.
# After building with jekyll, fix up some links
FROM gem AS generate
Expand Down
7 changes: 7 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ defaults:
# Fetch upstream resources (reference documentation) used by _plugins/fetch_remote.rb
# - repo is the GitHub repository to fetch from
# - ref the Git reference
# - completion_marker is a file path that, if it exists, will prevent a redownload from occurring
# - paths is a list to the resources within the remote repository
# - dest is the destination path within the working tree
# - src is a list of glob source paths within the remote repository
fetch-remote:
- repo: "https://github.com/docker/cli"
default_branch: "master"
ref: "20.10"
completion_marker: "engine/deprecated.md"
paths:
- dest: "engine/extend"
src:
Expand All @@ -148,6 +150,7 @@ fetch-remote:
- repo: "https://github.com/docker/docker"
default_branch: "master"
ref: "20.10"
completion_marker: "engine/api/version-history.md"
paths:
- dest: "engine/api"
src:
Expand All @@ -156,6 +159,7 @@ fetch-remote:
- repo: "https://github.com/docker/compose-cli"
default_branch: "main"
ref: "main"
completion_marker: "cloud/ecs-compose-features.md"
paths:
- dest: "cloud"
src:
Expand All @@ -166,6 +170,7 @@ fetch-remote:
- repo: "https://github.com/docker/buildx"
default_branch: "master"
ref: "master"
completion_marker: "build/bake/index.md"
paths:
- dest: "build/bake"
src:
Expand All @@ -174,6 +179,7 @@ fetch-remote:
- repo: "https://github.com/distribution/distribution"
default_branch: "main"
ref: "release/2.7"
completion_marker: "registry/spec/index.md"
paths:
- dest: "registry/spec"
src:
Expand All @@ -186,6 +192,7 @@ fetch-remote:
- repo: "https://github.com/moby/buildkit"
default_branch: "master"
ref: "master"
completion_marker: "engine/reference/builder.md"
paths:
- dest: "engine/reference/builder.md"
src:
Expand Down
10 changes: 9 additions & 1 deletion _plugins/fetch_remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ def pre_read(site)
puts "Starting plugin fetch_remote.rb..."
site.config['fetch-remote'].each do |entry|
puts " Repo #{entry['repo']} (#{entry['ref']})"

if(File.exist?(entry['completion_marker']))
fmp = FrontMatterParser::Parser.parse_file(entry['completion_marker'])
if fmp.content != ""
puts " Skipping fetch as #{entry['completion_marker']} exists"
next
end
end

Dir.mktmpdir do |tmpdir|
tmpfile = FetchRemote.download("#{entry['repo']}/archive/#{entry['ref']}.zip", tmpdir)
Dir.mktmpdir do |ztmpdir|
Expand Down Expand Up @@ -121,7 +130,6 @@ def pre_read(site)
end
end
end

end_time = Time.now
puts "done in #{(end_time - beginning_time)} seconds"
end
Expand Down
8 changes: 6 additions & 2 deletions _plugins/fix_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ def post_read(site)

Jekyll.logger.info " Fixing up URLs in swagger files"
Dir.glob(%w[./docker-hub/api/*.yaml ./engine/api/*.yaml]) do |file_name|
Jekyll.logger.info " #{file_name}"
text = File.read(file_name)
replace = text.gsub("https://docs.docker.com", "")
File.open(file_name, "w") { |file| file.puts replace }
if text == replace
Jekyll.logger.info " #{file_name} (skipped - no change)"
else
Jekyll.logger.info " #{file_name}"
File.open(file_name, "w") { |file| file.puts replace }
end
end

end_time = Time.now
Expand Down
6 changes: 4 additions & 2 deletions _plugins/update_api_toc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ def pre_read(site)
engine_ver = site.config['latest_engine_api_version']
toc_file = File.read("_data/toc.yaml")
replace = toc_file.gsub!("{{ site.latest_engine_api_version }}", engine_ver)
Jekyll.logger.info " Replacing '{{ site.latest_engine_api_version }}' with #{engine_ver} in _data/toc.yaml"
File.open("_data/toc.yaml", "w") { |file| file.puts replace }
if toc_file != replace
Jekyll.logger.info " Replacing '{{ site.latest_engine_api_version }}' with #{engine_ver} in _data/toc.yaml"
File.open("_data/toc.yaml", "w") { |file| file.puts replace }
end
end

end_time = Time.now
Expand Down
8 changes: 8 additions & 0 deletions dev-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [ "$JEKYLL_ENV" == "production" ]; then
echo "Starting in production mode"
exec bundle exec jekyll serve --host=0.0.0.0 -l --config _config.yml,_config_production.yml
else
exec bundle exec jekyll serve --host=0.0.0.0 -l
fi
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ services:
args:
- JEKYLL_ENV
context: .
target: dev
image: docs/docstage
ports:
- "4000:4000"
- 4000:4000
- 35729:35729
volumes:
- ./:/src