ofek / pyapp

Runtime installer for Python applications
https://ofek.dev/pyapp/
1.1k stars 24 forks source link

Can not just copy binary to docker and run. #99

Closed sandangel closed 2 months ago

sandangel commented 2 months ago

I built the binary from outside container then copied to container by using a a simple Dockerfile.

# syntax=docker/dockerfile:1
FROM debian:12-slim

WORKDIR /app

COPY ./dist/app/my-app-bin ./

RUN /app/my-app-bin self restore

ENTRYPOINT ["/app/my-app-bin"]

But docker build failed with:

STEP 5/6: RUN /app/my-app-bin self restore
/bin/sh: 1: /app/my-app-bin: not found
Error: building at STEP "RUN /app/my-app-bin self restore": while running runtime: exit status 127

Exec to container to call bin directly:

root@9c0da96a3e1d:/app# /app/my-app-bin self restore
bash: /app/my-app-bin: cannot execute: required file not found
root@9c0da96a3e1d:/app# ls
my-app-bin

Is it the correct way to build docker container with pyapp? How can I make it work? Thanks.

ofek commented 2 months ago

You need to build on the target architecture or set up cross compiling as mentioned in the docs. In this case, try building in the container.