From 30c02a1efb5e29b2a15d7c72cddbc95122118a2e Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Fri, 18 Feb 2022 15:51:53 +0200 Subject: [PATCH] Draft docker deploy for OBO site --- Dockerfile | 23 +++++++++++++++++++++++ Makefile | 29 +++++++++++++++++++++++++++++ docker_site.sh | 2 ++ 3 files changed, 54 insertions(+) create mode 100644 Dockerfile create mode 100644 docker_site.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..51d56dabe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM jekyll/jekyll:3.5.2 + +LABEL maintainer OBOFoundry + +ENV PYTHONUNBUFFERED=1 +RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python +RUN python3 -m ensurepip +RUN pip3 install --no-cache --upgrade pip setuptools +COPY requirements.txt requirements.txt +RUN apk add python3-dev +RUN pip3 install --no-cache -r requirements.txt +#RUN pip3 install --no-cache --upgrade pip setuptools frontmatter + +RUN mkdir -p /tools/ +ENV PATH "/tools/apache-jena/bin:/tools/sparqlprog/bin:$PATH" +# Install Jena. +RUN wget -nv http://archive.apache.org/dist/jena/binaries/apache-jena-3.12.0.tar.gz -O- | tar xzC /tools && \ + mv /tools/apache-jena-3.12.0 /tools/apache-jena + +RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community + + +CMD make all && jekyll serve \ No newline at end of file diff --git a/Makefile b/Makefile index b3872a9e2..2635dd22a 100644 --- a/Makefile +++ b/Makefile @@ -232,3 +232,32 @@ jenkins-output.txt: reports/%.csv: registry/ontologies.ttl sparql/%.sparql arq --data $< --query sparql/$*.sparql --results csv > $@.tmp && mv $@.tmp $@ + +################################################ +#### Commands for building the Docker image #### +################################################ +VERSION = "0.0.1" +IM=obolibrary/site +docker-build-no-cache: + @docker build --no-cache -t $(IM):$(VERSION) . \ + && docker tag $(IM):$(VERSION) $(IM):latest +docker-build: + @docker build -t $(IM):$(VERSION) . \ + && docker tag $(IM):$(VERSION) $(IM):latest +docker-build-use-cache-dev: + @docker build -t $(DEV):$(VERSION) . \ + && docker tag $(DEV):$(VERSION) $(DEV):latest +docker-clean: + docker kill $(IM) || echo not running ; + docker rm $(IM) || echo not made +docker-publish-no-build: + @docker push $(IM):$(VERSION) \ + && docker push $(IM):latest + +docker-publish-dev-no-build: + @docker push $(DEV):$(VERSION) \ + && docker push $(DEV):latest + +docker-publish: docker-build + @docker push $(IM):$(VERSION) \ + && docker push $(IM):latest \ No newline at end of file diff --git a/docker_site.sh b/docker_site.sh new file mode 100644 index 000000000..600da67e7 --- /dev/null +++ b/docker_site.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +docker run -v $PWD/:/srv/jekyll/ -p 4000:4000 --rm -it obolibrary/site