From c605f977eef61e0d5024fc3d89f1e9aaeaa5c9b4 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Sun, 12 May 2024 03:51:42 -0400 Subject: [PATCH] Add Dockerfile + instructions on how to preview site using docker rather than installing `hugo` locally (#56) --- Dockerfile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2ed37747 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Dockerfile for running the Parquet website locally +# +# Build an image called parquet-site with necessary tools +# docker build -t parquet-site . +# +# Run +# run docker container mounting the current directory to /parquet-site and exposing port 1313 +# docker run -it -v `pwd`:/parquet-site -p 1313:1313 parquet-site +# +# Now you can run npm and hugo commands in the container +FROM debian:bullseye-slim + +# run docker container mounting the current directory to /parquet-site and exposing port 1313 + +# Install necessary utilities +RUN apt-get update +RUN apt-get install wget git -y xz-utils + +# Install extended version of hugo to /hugo +# See releases https://github.com/gohugoio/hugo/releases/tag/v0.124.1 +# Note, if on amd64 use https://github.com/gohugoio/hugo/releases/download/v0.124.1/hugo_extended_0.124.1_linux-amd64.tar.gz +RUN wget -O - https://github.com/gohugoio/hugo/releases/download/v0.124.1/hugo_extended_0.124.1_linux-arm64.tar.gz | tar xz +RUN mv /hugo /usr/local/bin/hugo + +# install golang to /go +RUN wget -O - https://go.dev/dl/go1.22.3.linux-amd64.tar.gz | tar xz + +# install nodejs to /node-v20.13.1-linux-arm64 +RUN wget -O - https://nodejs.org/dist/v20.13.1/node-v20.13.1-linux-arm64.tar.xz | xz -d | tar x + +# setup path to find binaries +ENV PATH=/go/bin:/node-v20.13.1-linux-arm64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + + diff --git a/README.md b/README.md index 63829fcc..40303c7a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ This website is built / powered by [Hugo](https://gohugo.io/), and extended from the [Docsy Theme](https://www.docsy.dev/). -The following steps assume that you have `hugo` installed and working. +The following steps assume that you have `hugo` installed and working. +You can also use docker, see the [Docker section](#docker) for more information. ## Building and Running Locally @@ -14,7 +15,7 @@ cd parquet-site git submodule update --init --recursive ``` -To build or update your site’s CSS resources, you also need PostCSS to create the final assets. By default npm installs tools under the directory where you run npm install. +To build or update CSS resources, you also need PostCSS to create the final assets. By default npm installs tools under the directory where you run npm install. ``` npm install -D autoprefixer @@ -22,13 +23,43 @@ npm install -D postcss-cli npm install -D postcss ``` -To run this website site locally, run the following in the root of the directory: +To preview this website site locally, run the following in the root of the directory: ```shell hugo server ``` -# Release Documentation +## Building and Running in Docker + +If you don't want to install `hugo` and its dependencies on your local machine, +you can use docker. To do so, checkout the `parquet-site` repo as explained +above and then use [Dockerfile](Dockerfile) to build an image with the required +tools: + +```shell +docker build -t parquet-site . +```` + +Then run the container mounting the current directory to `/parquet-site` and +exposing local port 1313: + +```shell +docker run -it -v `pwd`:/parquet-site -p 1313:1313 parquet-site +``` + +Once inside the container, run the following to preview the site: +```shell +# Install necessary npm modules in parquet-site directory +cd parquet-site +npm install -D autoprefixer +npm install -D postcss-cli +npm install -D postcss +hugo server --bind 0.0.0.0 # run the server +``` + +You can now preview the site locally on http://localhost:1313/ + +# Release Process To create documentation for a new release of `parquet-format` create a new .md file under `content/en/blog/parquet-format`. Please see existing files in that directory as an example.