lvgl / lv_img_conv

Image converter for LVGL, written in JS
https://lvgl.github.io/lv_img_conv/
Other
94 stars 42 forks source link

Running in container fails #37

Open twam opened 11 months ago

twam commented 11 months ago

I followed the steps in the README to run lv_img_conv in a container:

docker build -t lv_img_conv .

It fails to build canvas@2.9.0. Adding the missing dependency

RUN apt update && apt install libsdl-pango-dev -y

to the docker solves this.

However if I then run

docker run -ti --rm -u 1000:1000 lv_img_conv lv_img_conv.js

it fails with:

npx: installed 17 in 1.434s
@swc/core threw an error when attempting to validate swc compiler options.
You may be using an old version of swc which does not support the options used by ts-node.
Try upgrading to the latest version of swc.
Error message from swc:
Failed to deserialize buffer as swc::config::Options
JSON: {"sourceMaps":true,"module":{"type":"commonjs","noInterop":false,"strictMode":true,"ignoreDynamic":false},"swcrc":false,"jsc":{"parser":{"syntax":"typescript","tsx":false,"dynamicImport":true,"importAssertions":true},"target":"es5","transform":{"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false,"runtime":"automatic"},"useDefineForClassFields":false},"keepClassNames":false,"experimental":{"keepImportAttributes":true,"emitAssertForImportAttributes":true}}}

Caused by:
    unknown field `keepImportAttributes`, expected one of `plugins`, `keepImportAssertions`, `cacheRoot` at line 1 column 484
cbeeler commented 11 months ago

My team is having the same issue on a build that hasn't changed but has suddenly started failing on our CI machines with the same error.

Risto97 commented 7 months ago

That Dockerfile is just wrong it seems:

I managed to get it to work with the following Dockerfile

FROM ubuntu:20.04

ENV PATH=/usr/src/app:$PATH

RUN mkdir -p /usr/src/app
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt install -y gcc make g++ pkg-config libpixman-1-dev libcairo2-dev libpango1.0-dev libjpeg8-dev libgif-dev nodejs npm
RUN npm install -g ts-node
COPY . /usr/src/app
RUN cd /usr/src/app && npm install

VOLUME /usr/src/proj

WORKDIR /usr/src/proj

ENTRYPOINT ["entrypoint.sh"]
toxxin commented 14 hours ago

@Risto97 your Dockerfile also doesn't work for me. I fixed the versions of core and ts and it seems it works now. It looks like:

FROM node:14

ENV PATH=/usr/src/app:$PATH

RUN mkdir -p /usr/src/app
COPY . /usr/src/app
RUN cd /usr/src/app && npm install typescript && npm install @swc/core@1.3.78 ts-node@10.9.1

VOLUME /usr/src/proj

WORKDIR /usr/src/proj

ENTRYPOINT ["entrypoint.sh"]