I'm attempting to run lektor within a docker container and have hit a problem.
If I 'ADD' (or 'COPY') my source code folder within my Dockerfile, everything works perfectly but, of course, the container is then not dynamic and doesn't respond to changes in the code.
If, instead, I use a volume, the container becomes dynamic and lektor successfully rebuilds and serves my site as I make changes.
However, when I come to publish the site, an error appears in the container's log and it enters a never-ending loop:
Started build
Debugging middleware caught exception in streamed response at a point where response headers were already sent.
Traceback (most recent call last):
File "/usr/local/lib/lektor/lib/python2.7/site-packages/lektor/admin/utils.py", line 18, in generate
for event in chain(f(*args, **kwargs), (None,)):
File "/usr/local/lib/lektor/lib/python2.7/site-packages/lektor/admin/modules/api.py", line 309, in generator
for event in event_iter:
File "/usr/local/lib/lektor/lib/python2.7/site-packages/lektor/publisher.py", line 639, in publish
self.link_artifacts(path)
File "/usr/local/lib/lektor/lib/python2.7/site-packages/lektor/publisher.py", line 602, in link_artifacts
link(full_path, dst)
OSError: [Errno 18] Invalid cross-device link
Minimal Dockerfile:
FROM python:2.7.11
RUN curl -sf https://www.getlektor.com/install.sh | \
sed '/stdin/d;s/input = .*/return/' | \
sh
I'm actually using docker-compose.
Minimal docker-compose.yml:
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/project
working_dir: /project/source
command: ['lektor', 'server', '--host', '0.0.0.0.']
(My project folder is structured such that the lektor project file and all the expected lektor folders are in the 'source' sub-folder).