Skip to content

Commit

Permalink
Add Dockerfile + instructions on how to preview site using docker rat…
Browse files Browse the repository at this point in the history
…her than installing `hugo` locally (#56)
  • Loading branch information
alamb authored May 12, 2024
1 parent 27a862b commit c605f97
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 4 deletions.
51 changes: 51 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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


39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -14,21 +15,51 @@ 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
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 <releaseNumber>.md file under `content/en/blog/parquet-format`. Please see existing files in that directory as an example.

Expand Down

0 comments on commit c605f97

Please sign in to comment.