Skip to content

Commit

Permalink
First attempt to build GitHub Pages site
Browse files Browse the repository at this point in the history
  • Loading branch information
manning-ncsa committed Oct 23, 2023
1 parent 8f250f3 commit 84e72eb
Show file tree
Hide file tree
Showing 19 changed files with 211 additions and 894 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/build-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: build-pages

on:
push:
branches:
- 'github-pages'
paths:
- '**'
- '.github/workflows/build-pages.yaml'

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to container registry
uses: docker/login-action@v1
with:
registry: "hub.ncsa.illinois.edu"
username: "${{ secrets.NCSA_HARBOR_DES_PUBLIC_USERNAME }}"
password: "${{ secrets.NCSA_HARBOR_DES_PUBLIC_TOKEN }}"
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: hub.ncsa.illinois.edu/des-public/desdm-public:pages
# From https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
-
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

-
uses: shrink/actions-docker-extract@v3
id: extract
with:
image: hub.ncsa.illinois.edu/des-public/desdm-public:pages
path: /srv/jekyll/.
-
name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ${{ steps.extract.outputs.destination }}
name: dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
*.pyc
static/files/SVA1/*
static/log.csv
__pycache__/
static/bower_components/*
.DS_Store
.codesync
static/des_components/elements-built.html

# Jekyll

# Gemfile
*.gem
.jekyll-cache
.bundle
.sass-cache
_site
Gemfile.lock
.idea
57 changes: 37 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
FROM ubuntu:20.04
FROM node:20 as build

RUN apt-get update && \
apt-get install -y \
python3-pip \
wget \
&& rm -rf /var/lib/apt/lists/*
# RUN apt-get update && \
# apt-get install -y \
# python3-pip \
# wget \
# && rm -rf /var/lib/apt/lists/*

# Basic python reqs
RUN pip3 install --no-cache-dir jira
RUN pip3 install --no-cache-dir netaddr
RUN pip3 install --no-cache-dir bcrypt
RUN pip3 install --no-cache-dir pyyaml
RUN pip3 install --no-cache-dir tornado==5.0.1
RUN pip3 install --no-cache-dir jsmin
# RUN pip3 install --no-cache-dir jira
# RUN pip3 install --no-cache-dir netaddr
# RUN pip3 install --no-cache-dir bcrypt
# RUN pip3 install --no-cache-dir pyyaml
# RUN pip3 install --no-cache-dir tornado==5.0.1
# RUN pip install --no-cache-dir jsmin

WORKDIR /opt
RUN wget https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz
RUN tar -C /usr/local --strip-components 1 -xf /opt/node-v12.14.1-linux-x64.tar.xz
# WORKDIR /tmp
# ADD https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz
# RUN tar -C /usr/local --strip-components 1 -xf /tmp/node-v12.14.1-linux-x64.tar.xz
RUN npm install -g [email protected]

RUN useradd --create-home --shell /bin/bash des --uid 1001
USER des
WORKDIR /home/des/
# RUN useradd --create-home --shell /bin/bash des --uid 1001
# USER des
WORKDIR /opt
COPY --chown=des:des ./ ./

RUN python3 vulcan.py --build
RUN vulcanize static/des_components/elements.html \
--exclude static/bower_components/polymer/lib/legacy/ \
--out-html static/des_components/elements-built.html

FROM jekyll/jekyll:3.8
## Currently jekyll/jekyll:4 fails with the error below so tag 3.8 is used instead.

ENV JEKYLL_UID=1000
ENV JEKYLL_GID=1000

USER ${JEKYLL_UID}

## Install required gems
COPY ./Gemfile ./Gemfile
RUN bundle install

## Copy source files
COPY --from=build --chown=${JEKYLL_UID}:${JEKYLL_GID} /opt/ ./

CMD [ "python3", "main.py" ]
CMD ["bundle", "exec", "jekyll", "serve", "--host=0.0.0.0", "--watch", "--drafts"]
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source "https://rubygems.org"

gem "github-pages", '228', group: :jekyll_plugins

# enable tzinfo-data for local build
# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
# gem 'jekyll-paginate', '1.1.0'
# gem 'faraday', '2.7.4'
# gem 'faraday-retry', '2.0.0'
# gem 'webrick', '1.8.1'
135 changes: 0 additions & 135 deletions ImportPagesScript.py

This file was deleted.

19 changes: 0 additions & 19 deletions Settings.py

This file was deleted.

Loading

0 comments on commit 84e72eb

Please sign in to comment.