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

Docker build #65

Draft
wants to merge 2 commits into
base: master
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
25 changes: 25 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
kind: pipeline
type: docker
name: default

steps:
- name: build
image: abakus/statuttbuilder:latest
commands:
- ./generate.sh
when:
event:
- pull_request

- name: push
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work yet, but it's supposed to do the same things as Travis does, where it builds then pushes the public code to another branch, which is served.

The whole process isn't planned yet.

image: appleboy/drone-git-push
settings:
remote_name: origin
branch: dronebbuild
force: false
commit: true
commit_message: "DroneCI new build"
when:
event:
- pull_request
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
gh-pages/index.html
gh-pages/fond/index.html
gh-pages/_site
logs/

## Core latex/pdflatex auxiliary files:
*.aux
*.lof
Expand All @@ -15,7 +10,6 @@ logs/
*.fot
*.cb
*.cb2
*.pdf

## Intermediate documents:
*.dvi
Expand All @@ -25,7 +19,6 @@ logs/
*.ps
report.pdf
svg-inkscape/
*.pdf

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
Expand Down Expand Up @@ -224,4 +217,6 @@ TSWLatexianTemp*
# expex forward references with \gathertags
*-tags.tex

.DS_Store

.now
1 change: 0 additions & 1 deletion .latexmkrc

This file was deleted.

16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:18.04

RUN apt-get update

RUN apt-get install -y --no-install-recommends \
texlive \
texlive-latex-base \
texlive-font-utils \
texlive-lang-european \
pandoc \
ghostscript

WORKDIR /statutter
#
#COPY ./generate.sh /
#
#CMD /generate.sh
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

67 changes: 24 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,30 @@
# Abakus' statutter [![Build Status](https://travis-ci.org/abakus-ntnu/statutter.svg?branch=master)](https://travis-ci.org/abakus-ntnu/statutter)
Her finner du LaTeX-kildekoden til statuttene til Abakus Linjeforening.
Send gjerne endringsforslag via pull-requests, les mer om reglene for
statuttendringer i [CONTRIBUTING.md](CONTRIBUTING.md).

## Bygging av PDF
### Installering av pdfTeX
pdfTeX kreves for å bygge statuttene. Det kan installeres på følgende måte:

macOS (krever [Homebrew](https://brew.sh/)):
```bash
brew cask install mactex
```
# Abakus' statutter

Ubuntu:
```bash
sudo apt-get install texlive texlive-font-utils texlive-lang-european latexmk
```
Her finner du LaTeX-kildekoden til statuttene til Abakus Linjeforening. Send gjerne endringsforslag via pull-requests, les mer om reglene for statuttendringer i [CONTRIBUTING.md](CONTRIBUTING.md).

### Kompilere PDF
```bash
make
```
## Organisering

## Nettside
### Publisering
[GitHub Pages](https://pages.github.com/) brukes til å hoste
[statutter.abakus.no](https://statutter.abakus.no). Opplastning av siste versjon
skjer automatisk av [Travis](https://travis-ci.org/abakus-ntnu/statutter) når
commits blir pushet til master.

### Lokal utvikling
#### Avhengigheter
macOS (krever [Homebrew](https://brew.sh/)):
```bash
brew install pandoc
```
`statutter` mappen inneholder kildekoden til statuttene.

Ubuntu:
```bash
sudo apt-get install pandoc
```
`static` mappen inneholder filer som blir brukt under generering av nettsiden.

`public` mappen inneholder alt av output som docker containeren genererer. Denne mappen blir entrypoint for nettsiden, og det er disse html og css filene som brukere ser.

## Bygging av statutter

Alle statuttene bygges ved hjelp av et `docker` image som har all programvare som trengs, samt et generering script som bruker denne programvaren. Scriptet bygger både `pdf` og `html` versjon av statuttene.

### Kjør bilde ved hjelp av følgende kommando

Den mounter de tre volumene `statutter, static og public` som blir brukt av bildet når den bygger statutter.

I tillegg kan du sende inn `ASSEMBLY_DATE` som en variabel, og den genererte pdf filen som blir arkivert får dette navnet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this env-var doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a thing back in the day, but now it's deprecated.


#### Bygging
```bash
make jekyll
cd gh-pages
bundle exec jekyll serve
```sh
$ docker run --rm \
-v `pwd`/statutter:/statutter/ \
-v `pwd`/static:/static/ \
-v `pwd`/public:/public/ \
-e ASSEMBLY_DATE=01.januar.1970 \
abakus/statuttbuilder:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to use the Dockerfile instead, to make sure that the correct version is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be a good idea

```
8 changes: 0 additions & 8 deletions abakus-statutter/innhold.tex

This file was deleted.

33 changes: 33 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
TIMESTAMP=`eval date +%d.%B.%Y`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a shell script to generate them, instead of the Makefile?

If we have a shell-script, it should at least do proper error handling to make it possible to understand if something fails...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should at least enforce shellcheck


# Convert abakus LaTeX to html
pandoc -f latex -o public/index.html \
--include-in-header=static/head.html \
--include-before-body=static/abakus.html \
--include-after-body=static/end.html \
statutter/abakus-statutter/innhold.tex

# Move other static files to the public folder
cp static/main.css static/abakule.jpg public/

# Convert abakus LaTeX to PDF
pdflatex -halt-on-error statutter/abakus-statutter.tex
pdflatex -halt-on-error statutter/abakus-statutter.tex
pdflatex -pdf -halt-on-error -output-dir="./public" statutter/abakus-statutter.tex

# Store a copy of the pdf in the archive
mkdir -p public/archive/
cp public/*.pdf public/archive/$TIMESTAMP.pdf

# Clean up the Statutter directory, as it used to genereate fles
rm -f ./statutter/*.log \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove these files?

./statutter/*.aux \
./statutter/*.out \
./statutter/*.toc \
./statutter/*.pdf # The result PDF is moved to /public by pdflatex

# Clean up the public directory, as it's used to genereate fles
rm -f ./public/*.log \
./public/*.aux \
./public/*.out \
./public/*.toc \
1 change: 0 additions & 1 deletion gh-pages/CNAME

This file was deleted.

2 changes: 0 additions & 2 deletions gh-pages/Gemfile

This file was deleted.

Loading