ClementNerma / tapo-rest

An unofficial REST API to remotely control Tapo devices
28 stars 3 forks source link

Compile error using Dockerfile #12

Closed paha77 closed 2 days ago

paha77 commented 4 days ago

I got compile errors when I try to build a container with this Dockerfile:

FROM rust AS builder
WORKDIR /usr/src/myapp
RUN cargo install --git https://github.com/ClementNerma/tapo-rest --root /usr/src/myapp
105.9    Compiling tapo-rest v0.1.1 (/usr/local/cargo/git/checkouts/tapo-rest-5bbf6afef063f897/b569529)
106.4 error[E0308]: `?` operator has incompatible types
106.4    --> src/server/actions.rs:316:21
106.4     |
106.4 99  |                 ) -> ApiResult<$ret_type> {
106.4     |                      -------------------- expected `tapo::responses::DeviceInfoPlugResult` because of return type
106.4 ...
106.4 316 |             Ok(Json(client.get_device_info().await?))
106.4     |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `DeviceInfoPlugResult`, found `DeviceInfoPlugEnergyMonitoringResult`
106.4     |
106.4     = note: `?` operator cannot convert from `DeviceInfoPlugEnergyMonitoringResult` to `tapo::responses::DeviceInfoPlugResult`
106.4
107.0 For more information about this error, try `rustc --explain E0308`.
107.1 error: could not compile `tapo-rest` (bin "tapo-rest") due to 1 previous error
107.1 error: failed to compile `tapo-rest v0.1.1 (https://github.com/ClementNerma/tapo-rest#b5695298)`, intermediate artifacts can be found at `/tmp/cargo-install90KpGV`.
107.1 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
------
failed to solve: process "/bin/sh -c cargo install --git https://github.com/ClementNerma/tapo-rest --root /usr/src/myapp" did not complete successfully: exit code: 101

It used to work a few months ago.

Do you have any suggestions?

Thank you.

ClementNerma commented 2 days ago

Hi,

I just updated the dependencies on the main branch, but the problem may arise in the future in you don't use the --locked option of cargo install.

When installing from a Git repository, you should always provide it, otherwise cargo unfortunately ignores the project's lockfile (see https://github.com/rust-lang/cargo/issues/7169).

paha77 commented 2 days ago

Hi,

I just updated the dependencies on the main branch, but the problem may arise in the future in you don't use the --locked option of cargo install.

When installing from a Git repository, you should always provide it, otherwise cargo unfortunately ignores the project's lockfile (see rust-lang/cargo#7169).

Thank you, it helped.