Page MenuHomeSoftware Heritage

D797.diff
No OneTemporary

D797.diff

diff --git a/Makefile b/Makefile
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,50 @@
+BUILD_CONTEXT ?= ../
+
+ALL_DOCKERFILES := $(wildcard dockerfiles/Dockerfile-*)
+ALL_BUILD_TARGETS := $(subst dockerfiles/Dockerfile-,build-,$(ALL_DOCKERFILES))
+
+TEMP_DIR := $(shell mktemp -d /tmp/swh_dockerfiles.tmp.XXXXXXXXXX)
+DOCKERFILE_SWH_DEPS := $(TEMP_DIR)/Dockerfile-swh-deps
+REQUIREMENT_FILES := $(wildcard ../*/requirements.txt)
+
+all: $(ALL_BUILD_TARGETS)
+
+.PHONY: build-swh-base
+
+# Hack to build a base Docker image with SWH's dependencies (slow to build)
+# installed *before* using COPY on SWH's source code, so it
+# won't be rebuilt on every single change in SWH's source code.
+build-swh-deps: $(REQUIREMENT_FILES)
+ @echo "FROM python:3" >> $(DOCKERFILE_SWH_DEPS)
+ @echo "RUN apt-get update" >> $(DOCKERFILE_SWH_DEPS)
+ @echo "RUN apt-get install -y myrepos libsystemd-dev libapr1-dev libaprutil1-dev libsvn-dev" >> $(DOCKERFILE_SWH_DEPS)
+ @echo -n "RUN pip install " >> $(DOCKERFILE_SWH_DEPS)
+ @cd ..; ./bin/pip-ls-deps 2> /dev/null | sed "s/\(.*\)/\\\'\1\\\'/" | xargs echo >> $(DOCKERFILE_SWH_DEPS)
+ @echo ""
+ @echo "+----------------------------------------------------------+"
+ @echo "| Building Docker image with SWH's dependencies installed. |"
+ @echo "+----------------------------------------------------------+"
+ @echo ""
+ docker build -f $(DOCKERFILE_SWH_DEPS) -t swh-deps $(BUILD_CONTEXT)
+ @# remove the current temporary dir, as well as older ones that
+ @# may remain after a crash
+ @rm -rf /tmp/swh_dockerfiles.tmp.*
+
+build-swh-base: build-swh-deps
+ @echo ""
+ @echo "+----------------------------------------------+"
+ @echo "| Building Docker image with SWH's source code |"
+ @echo "+----------------------------------------------+"
+ @echo ""
+ docker build -f dockerfiles/Dockerfile-swh-base -t swh-base $(BUILD_CONTEXT)
+
+build-%: dockerfiles/Dockerfile-% build-swh-base
+ @echo ""
+ @echo "+------------------------------------------+"
+ @echo "| Building component-specific Docker image |"
+ @echo "+------------------------------------------+"
+ @echo ""
+ docker build -f $< -t $(subst build-,,$@) $(BUILD_CONTEXT)
+
+run-%: build-%
+ docker run $(subst run-,,$@)
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -3,3 +3,14 @@
[Work in progress]
This repo contains Dockerfiles to allow developers to run a small Software Heritage instance on their development computer.
+
+## How to use
+
+For now:
+
+```
+make run-swh-objstorage
+```
+
+This will build intermediate containers and run the objstorage
+(it's a daemon, so it won't exit until you kill it).
diff --git a/config/objstorage/server.yml b/config/objstorage/server.yml
new file mode 100644
diff --git a/dockerfiles/Dockerfile-swh-base b/dockerfiles/Dockerfile-swh-base
new file mode 100644
--- /dev/null
+++ b/dockerfiles/Dockerfile-swh-base
@@ -0,0 +1,9 @@
+FROM swh-deps
+
+WORKDIR /usr/local/src/
+
+COPY . .
+
+RUN pip install $(./bin/pip-swh-packages 2> /dev/null)
+
+RUN cp -R /usr/local/src/swh-docker-dev/config/* /etc/softwareheritage/
diff --git a/dockerfiles/Dockerfile-swh-objstorage b/dockerfiles/Dockerfile-swh-objstorage
new file mode 100644
--- /dev/null
+++ b/dockerfiles/Dockerfile-swh-objstorage
@@ -0,0 +1,5 @@
+FROM swh-base
+
+RUN mkdir -p /srv/softwareheritage/objects
+
+ENTRYPOINT ["python", "-m", "swh.objstorage.api.server", "/etc/softwareheritage/objstorage/server.yml"]

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 2:30 PM (8 h, 1 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224531

Event Timeline