rust-lang / docker-rust

The official Docker images for Rust
428 stars 89 forks source link

Missing apt sources #181

Closed dipk-mish7 closed 4 months ago

dipk-mish7 commented 4 months ago

I tried to write a dockerfile using 1.76.0 and found that this image has no longer /etc/apt/sources.list, This is present in 1.70.0 image.. Could u please let me know if this is expected? I was using rust 1.70.0 image in my dockerfile as base image for svix. This had /etc/apt/sources.list file in it and I was updating my jfrog artifactory packages in it.. but for some reasons 1.76.0 version of docker image of rust do not have this..

I posted it here too https://github.com/rust-lang/docker-rust/issues/182

sfackler commented 4 months ago

This is based off of the upstream debian image. You'd need to check if something changed there. I'd guess they moved things to /etc/apt/sources.list.d or whatever it's called.

dipk-mish7 commented 4 months ago

yes.. I can only see /etc/apt/sources.list.d but not sure where should I add my dependency of artifactory. Below is the sample Dockerfile which was working fine with rust 1.70.0 base image

FROM artifactory.myorg.com/rust:1.70.0 AS build
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && mv /etc/apt/sources.list.d /etc/apt/sources.list.bak.d
RUN sh -c "echo 'deb https://myuser:mypassword@artifactory.myorg.com/artifactory/debian-main-remote bullseye main' | tee -a /etc/apt/sources.list"
RUN apt-get update && apt-get install -y build-essential=12.* checkinstall=1.* zlib1g-dev=1:* pkg-config=0.29.* libssl-dev=* --no-install-recommends

But fails for below as source.list is not present anymore

FROM artifactory.myorg.com/rust:1.76.0 AS build
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && mv /etc/apt/sources.list.d /etc/apt/sources.list.bak.d
RUN sh -c "echo 'deb https://myuser:mypassword@artifactory.myorg.com/artifactory/debian-main-remote bullseye main' | tee -a /etc/apt/sources.list"
RUN apt-get update && apt-get install -y build-essential=12.* checkinstall=1.* zlib1g-dev=1:* pkg-config=0.29.* libssl-dev=* --no-install-recommends

Is there anything I can do here.. I tried to do workaround by creating this source.list manually but I get below error when I do that.

W: GPG error: https://artifactory.myorg.com/artifactory/debian-main-remote bullseye InRelease: At least one invalid signature was encountered. E: The repository 'https://artifactory.myorg.com/artifactory/debian-main-remote bullseye InRelease' is not signed. E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/.deb /var/cache/apt/archives/partial/.deb /var/cache/apt/*.bin || true' E: Sub-process returned an error code

For reference I am trying to customise this https://github.com/svix/svix-webhooks/blob/main/server/Dockerfile for my org.. it was working fine with rust 1.70.0

sfackler commented 4 months ago

What does Google say about adding sources to /etc/apt/sources.list.d?

dipk-mish7 commented 4 months ago

Couldn't get anything on google related to this but I did tried to add it here /etc/apt/sources.list.d image

however it gave me below error @sfackler image

sfackler commented 4 months ago

/etc/apt/sources.list.d is supposed to be a directory of files, not a file.

Here is the first Google result I get when searching for it: https://stackoverflow.com/questions/26020917/what-is-the-function-of-etc-apt-sources-list-d