Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build docker image via GitHub Actions #426

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
43 changes: 34 additions & 9 deletions .github/workflows/manubot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ jobs:
with:
# fetch entire commit history to support get_rootstock_commit
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
load: true
context: build
tags: |
ghcr.io/${{ github.repository_owner }}/manubot:latest
cache-to: type=inline
- name: Show Docker images
run: docker images --all
- name: Set Environment Variables
run: |
TRIGGERING_SHA=${GITHUB_PULL_REQUEST_SHA:-$GITHUB_SHA}
Expand All @@ -30,29 +50,34 @@ jobs:
echo "DEFAULT_BRANCH=${DEFAULT_BRANCH}" >> $GITHUB_ENV
echo "DEFAULT_BRANCH_REF=refs/heads/$DEFAULT_BRANCH" >> $GITHUB_ENV
echo "DEFAULT_BRANCH=$DEFAULT_BRANCH"
echo "IMAGE=ghcr.io/${{ github.repository_owner }}/manubot" >> $GITHUB_ENV
- name: Cache
uses: actions/cache@v1
with:
path: ci/cache
key: ci-cache-${{ github.ref }}
restore-keys: |
ci-cache-${{ env.DEFAULT_BRANCH_REF }}
- name: Install Environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: manubot
environment-file: build/environment.yml
auto-activate-base: false
miniconda-version: 'latest'
# - name: Install Environment
# uses: conda-incubator/setup-miniconda@v2
# with:
# activate-environment: manubot
# environment-file: build/environment.yml
# auto-activate-base: false
# miniconda-version: 'latest'
- name: Install Spellcheck
shell: bash --login {0}
run: |
if [ "${SPELLCHECK:-}" = "true" ]; then
bash ci/install-spellcheck.sh
fi
- name: Build Manuscript
shell: bash --login {0}
run: bash build/build.sh
run: |
docker run \
--workdir /manuscript \
--mount "type=bind,source=$(pwd),target=/manuscript" \
$IMAGE \
bash build/build.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
Expand Down
16 changes: 16 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM condaforge/miniforge3:latest

ARG CONDA_PREFIX=/opt/conda
ARG CONDA_ENV=manubot

COPY environment.yml /
RUN conda env create \
--prefix=$CONDA_PREFIX/envs/$CONDA_ENV \
--file=/environment.yml \
&& conda clean --all --force-pkgs-dirs --yes

ENV PATH $CONDA_PREFIX/envs/$CONDA_ENV/bin:$PATH
RUN echo "source activate $CONDA_ENV" > ~/.bashrc
RUN /bin/bash -c "source activate $CONDA_ENV"

ENV CONDA_DEFAULT_ENV=$CONDA_ENV
3 changes: 2 additions & 1 deletion build/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- cairo=1.14.12
- cairocffi=0.8.0
- cffi=1.12.3
- gcc_linux-64=9.3.0 # required for pip install pysha3
- ghp-import=0.5.5
- jinja2=2.11.2
- jsonschema=3.2.0
Expand All @@ -30,7 +31,7 @@ dependencies:
- pandoc-tablenos==2.2.2
- pandoc-xnos==2.4.3
- pybase62==0.4.3
- pysha3==1.0.2
- pysha3==1.0.2 # required for opentimestamps
- python-bitcoinlib==0.10.2
- requests-cache==0.5.2
- weasyprint==0.42.3