Skip to content

Commit

Permalink
Add option to use docker to build the website
Browse files Browse the repository at this point in the history
  • Loading branch information
F21 committed May 29, 2018
1 parent 6fe55e3 commit cb5d9ba
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 8 deletions.
1 change: 1 addition & 0 deletions site/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.sass-cache
Gemfile.lock
.jekyll-metadata
8 changes: 6 additions & 2 deletions site/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
# limitations under the License.
#
source 'https://rubygems.org'
gem 'github-pages', '150'
gem 'github-pages', '182'
gem 'rouge'
gem 'jekyll_oembed'
gem 'jekyll-redirect-from'

group :jekyll_plugins do
gem 'jekyll_oembed'
end

# End Gemfile
41 changes: 35 additions & 6 deletions site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,60 @@ limitations under the License.
This directory contains the code for the Apache Calcite web site,
[calcite.apache.org](https://calcite.apache.org/).

## Setup
You can build the site manually using your environment or use the docker compose file.

Site generation currently works best with ruby-2.4.1.
## Manually

### Setup your environment

Site generation currently works best with ruby-2.5.1.

1. `cd site`
2. `svn co https://svn.apache.org/repos/asf/calcite/site target`
3. `sudo apt-get install rubygems ruby2.1-dev zlib1g-dev` (linux)
4. `sudo gem install bundler github-pages jekyll jekyll-oembed`
3. `sudo apt-get install rubygems ruby2.5-dev zlib1g-dev` (linux)
4. `sudo gem install bundler`
5. `bundle install`

## Add javadoc
### Add javadoc

1. `cd ..`
2. `mvn -DskipTests site`
3. `rm -rf site/target/apidocs site/target/testapidocs`
4. `mv target/site/apidocs target/site/testapidocs site/target`

## Running locally
### Running locally

Before opening a pull request, you can preview your contributions by
running from within the directory:

1. `bundle exec jekyll serve`
2. Open [http://localhost:4000](http://localhost:4000)

## Using docker

### Setup your environment

1. Install [docker](https://docs.docker.com/install/)
2. Install [docker-compose](https://docs.docker.com/compose/install/)

### Build site
1. `cd site`
2. `docker-compose run build-site`

### Generate javadoc
1. `cd site`
2. `docker-compose run generate-javadoc`

### Running development mode locally
You can preview your work while working on the site.

1. `cd site`
2. `docker-compose run --service-ports dev`

The web server will be started on [http://localhost:4000](http://localhost:4000)

As you make changes to the site, the site will automatically rebuild.

## Pushing to site

1. `cd site`
Expand Down
38 changes: 38 additions & 0 deletions site/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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.

version: '3'
services:
dev:
image: jekyll/jekyll:3
command: jekyll serve --watch --force_polling
ports:
- 4000:4000
volumes:
- .:/srv/jekyll
build-site:
image: jekyll/jekyll:3
command: jekyll build
volumes:
- .:/srv/jekyll
generate-javadoc:
image: maven:alpine
working_dir: /usr/src/calcite
command: sh -c "mvn -DskipTests site; rm -rf site/target/apidocs site/target/testapidocs; mkdir -p site/target; mv target/site/apidocs target/site/testapidocs site/target"
volumes:
- ../:/usr/src/calcite
- maven-repo:/root/.m2
volumes:
maven-repo:

0 comments on commit cb5d9ba

Please sign in to comment.