hodgesmr / mastodon_digest

A Python script that aggregates recent popular posts from your Mastodon timeline
BSD 3-Clause "New" or "Revised" License
439 stars 58 forks source link

"Make Run" is not working #38

Closed BentiGorlich closed 1 year ago

BentiGorlich commented 1 year ago

I checked out tag 0.3.1 and tried to build and run the docker container, but the run command did not work

make build:

docker build -f Dockerfile \
-t hodgesmr/mastodon-digest:0.3.1 \
-t hodgesmr/mastodon-digest:latest . \
--build-arg VERSION=0.3.1 \
--build-arg BUILD_DATE="Fr 14. Apr 08:57:40 UTC 2023" \
--build-arg VCS_REF=be98741 \
--build-arg NAME=mastodon-digest \
--build-arg VENDOR="Matt Hodges" \
--build-arg ORG=hodgesmr \
--build-arg WORKDIR="/opt/mastodon-digest"
[+] Building 19.6s (14/14) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 1.05kB                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/python:3.11-slim-bullseye                                                                                                                                                                                                                                            0.5s
 => [internal] load build context                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 774B                                                                                                                                                                                                                                                                                       0.0s
 => [1/9] FROM docker.io/library/python:3.11-slim-bullseye@sha256:286f2f1d6f2f730a44108656afb04b131504b610a6cb2f3413918e98dabba67e                                                                                                                                                                                      0.0s
 => CACHED [2/9] WORKDIR /opt/mastodon-digest                                                                                                                                                                                                                                                                           0.0s
 => CACHED [3/9] COPY requirements.txt .                                                                                                                                                                                                                                                                                0.0s
 => [4/9] RUN mkdir -p venvs                                                                                                                                                                                                                                                                                            0.4s
 => [5/9] RUN python3 -m venv venvs/mastodon-digest                                                                                                                                                                                                                                                                     4.3s
 => [6/9] RUN venvs/mastodon-digest/bin/pip install --upgrade pip                                                                                                                                                                                                                                                       3.0s
 => [7/9] RUN venvs/mastodon-digest/bin/pip install -r requirements.txt                                                                                                                                                                                                                                                 9.6s
 => [8/9] COPY templates/ ./templates/                                                                                                                                                                                                                                                                                  0.1s
 => [9/9] COPY *.py ./                                                                                                                                                                                                                                                                                                  0.1s
 => exporting to image                                                                                                                                                                                                                                                                                                  1.5s
 => => exporting layers                                                                                                                                                                                                                                                                                                 1.5s
 => => writing image sha256:5ba9c5b3b324ad5501f9bb13a2bfc67c738e4ffacd5ef077c16e00edf83926ef                                                                                                                                                                                                                            0.0s
 => => naming to docker.io/hodgesmr/mastodon-digest:0.3.1                                                                                                                                                                                                                                                               0.0s
 => => naming to docker.io/hodgesmr/mastodon-digest:latest

make run:

docker run --env-file .env -it --rm -v "/render:"/opt/mastodon-digest"/render" hodgesmr/mastodon-digest
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "venvs/mastodon_digest/bin/python3": stat venvs/mastodon_digest/bin/python3: no such file or directory: unknown.
make: *** [Makefile:51: run] Fehler 127

I also tried:

but got the same error message

hodgesmr commented 1 year ago

What host system are you running on?

Something that looks a bit odd: the first line of output in your make run looks to be attempting to mount a Docker volume at /render, instead of at $PWD/render.

I just pushed 0.3.2 to clean up the Makefile slightly (also saw unexpected " in your output). Can you try that?

Also, what's the output of make print?

BentiGorlich commented 1 year ago

Is still not working. I am running on: Linux 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 make build:

sudo make build
[sudo] Passwort für benni:
docker build -f Dockerfile \
-t hodgesmr/mastodon-digest:0.3.2 \
-t hodgesmr/mastodon-digest:latest . \
--build-arg VERSION=0.3.2 \
--build-arg BUILD_DATE="Fr 14. Apr 14:51:33 UTC 2023" \
--build-arg VCS_REF=6574e63 \
--build-arg NAME=mastodon-digest \
--build-arg VENDOR="Matt Hodges" \
--build-arg ORG=hodgesmr \
--build-arg WORKDIR=/opt/mastodon-digest
[+] Building 19.9s (14/14) FINISHED
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 1.05kB                                                                             0.0s
 => [internal] load metadata for docker.io/library/python:3.11-slim-bullseye                                       1.0s
 => [1/9] FROM docker.io/library/python:3.11-slim-bullseye@sha256:286f2f1d6f2f730a44108656afb04b131504b610a6cb2f3  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 774B                                                                                  0.0s
 => CACHED [2/9] WORKDIR /opt/mastodon-digest                                                                      0.0s
 => CACHED [3/9] COPY requirements.txt .                                                                           0.0s
 => [4/9] RUN mkdir -p venvs                                                                                       0.3s
 => [5/9] RUN python3 -m venv venvs/mastodon-digest                                                                4.4s
 => [6/9] RUN venvs/mastodon-digest/bin/pip install --upgrade pip                                                  3.1s
 => [7/9] RUN venvs/mastodon-digest/bin/pip install -r requirements.txt                                            9.4s
 => [8/9] COPY templates/ ./templates/                                                                             0.1s
 => [9/9] COPY *.py ./                                                                                             0.1s
 => exporting to image                                                                                             1.4s
 => => exporting layers                                                                                            1.4s
 => => writing image sha256:bc4a85d6cb07eb66334e69a48a291202801d96afae04cd33e24012a6f0f43a05                       0.0s
 => => naming to docker.io/hodgesmr/mastodon-digest:0.3.2                                                          0.0s
 => => naming to docker.io/hodgesmr/mastodon-digest:latest

make run:

docker run --env-file .env -it --rm -v "/render:/opt/mastodon-digest/render" hodgesmr/mastodon-digest
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "venvs/mastodon_digest/bin/python3": stat venvs/mastodon_digest/bin/python3: no such file or directory: unknown.
make: *** [Makefile:52: run] Fehler 127

make print:

PWD=/home/benni/mastodon-digest
BUILD_DATE=Fr 14. Apr 14:52:11 UTC 2023
NAME=mastodon-digest
ORG=hodgesmr
VCS_REF=6574e63
VENDOR=Matt Hodges
VERSION=0.3.2
WORKDIR=/opt/mastodon-digest
USER_OPTIONS=
BentiGorlich commented 1 year ago

Thanks for your quick reply btw :)

hodgesmr commented 1 year ago

Aha! Are you always running with sudo? Looks like that causes issues:

When we invoke a command via sudo, sudo will fork another process to perform the command. And for some security reasons or of other aspects, not all the environments of the current process will be inheritted. The following example will demonstrate this point:

$ printenv | grep PWD
PWD=/Users/jerome
$ sudo printenv | grep PWD
$

Is there are reason you aren't running make build and make run as a normal user?