mataroa-blog / mataroa

Naked blogging platform
https://mataroa.blog
GNU Affero General Public License v3.0
265 stars 21 forks source link

Error in initial startup using docker compose #88

Closed TimHi closed 1 week ago

TimHi commented 1 week ago

I wanted to try mataro local on my windows machine before deploying it a server.
I've cloned the repo, created a .envrc based on the example env file.

However running docker compose up -dproduces an error:

[+] Running 0/1
 - web Warning                                                                                                                                                                        1.5s 
[+] Building 1.6s (12/12) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s 
 => => transferring dockerfile: 551B                                                                                                                                                  0.0s 
 => [internal] load metadata for docker.io/library/python:3.11                                                                                                                        0.6s 
 => [internal] load .dockerignore                                                                                                                                                     0.0s 
 => [1/8] FROM docker.io/library/python:3.11@sha256:706d1233c61a31507c4f8939cfd6a924610b51174c095f33e2c537fb904a1e76                                                                  0.1s 
 => => resolve docker.io/library/python:3.11@sha256:706d1233c61a31507c4f8939cfd6a924610b51174c095f33e2c537fb904a1e76                                                                  0.0s 
 => [internal] load build context                                                                                                                                                     0.2s 
 => => transferring context: 134.45kB                                                                                                                                                 0.1s 
 => CACHED [2/8] RUN apt-get update &&     apt-get install -y --no-install-recommends     swig     libssl-dev     dpkg-dev     netcat-traditional     && rm -rf /var/lib/apt/lists/*  0.0s 
 => CACHED [3/8] COPY requirements.txt /code/                                                                                                                                         0.0s 
 => CACHED [4/8] COPY requirements.dev.txt /code/                                                                                                                                     0.0s 
 => CACHED [5/8] RUN pip install -U pip && pip install -Ur /code/requirements.txt && pip install -Ur /code/requirements.dev.txt                                                       0.0s 
 => CACHED [6/8] WORKDIR /code                                                                                                                                                        0.0s 
 => [7/8] COPY . /code/                                                                                                                                                               0.3s 
 => ERROR [8/8] RUN /code/manage.py collectstatic --noinput                                                                                                                           0.2s 
------
 > [8/8] RUN /code/manage.py collectstatic --noinput:
#0 0.175 /usr/bin/env: ‘python\r’: No such file or directory
#0 0.175 /usr/bin/env: use -[v]S to pass options in shebang lines
------
failed to solve: process "/bin/sh -c /code/manage.py collectstatic --noinput" did not complete successfully: exit code: 127

Googling the error pointed me to this thread and changing the first line in manage.py like below solved the issue and led to a successfull start.

- #!/usr/bin/env python
+ #!/usr/bin/env -S python

It seems like the extra argument passed to manage.py is causing this: RUN /code/manage.py collectstatic --noinput

Not modifying the shebang and removing the collectstatic argument like below also results in an successfull start:

- RUN /code/manage.py collectstatic --noinput
+ RUN /code/manage.py

I assume adding the -S flag is the more appropriate fix. The issue is not present when running docker compose up -d on my linux server and changing it to the -S flag makes no difference there.

I"ve created a PR for this: #89

TimHi commented 1 week ago

Guess this can be closed now :D Thanks for the quick merge!