A new project is created: rust/health.

The objective is to:

  • Learn rust
  • Record my health stats
  • Have fun

docker

I downloaded the Dockerfile from the official rust image on Docker hub, but I had to update the versions to get it working. This was a very small issue.

FROM rust:1.89 AS builder
WORKDIR /usr/src/health
COPY . .
RUN cargo install --path .

FROM debian:trixie-slim
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/health /usr/local/bin/health
CMD ["health"]

Build image

$ docker build . -t cvdg/health:0.1.0
[+] Building 31.8s (14/14) FINISHED                                                                         docker:default
 => [internal] load build definition from Dockerfile                                                                  0.0s
 => => transferring dockerfile: 336B                                                                                  0.0s
 => [internal] load metadata for docker.io/library/debian:trixie-slim                                                 1.4s
 => [internal] load metadata for docker.io/library/rust:1.89                                                          1.7s
 => [auth] library/debian:pull token for registry-1.docker.io                                                         0.0s
 => [auth] library/rust:pull token for registry-1.docker.io                                                           0.0s
 => [internal] load .dockerignore                                                                                     0.0s
 => => transferring context: 2B                                                                                       0.0s
 => [stage-1 1/2] FROM docker.io/library/debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945  18.7s
 => => resolve docker.io/library/debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c78  0.0s
 => => sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb 8.97kB / 8.97kB                        0.0s
 => => sha256:f2306da7a8fb6440535937baed0ce0018736742d6dc5beec9d6a31355b259726 1.02kB / 1.02kB                        0.0s
 => => sha256:c4f2d356126a64905e3a04f1c23b3f9748411b795ced0b7a436b516b4a791cb6 451B / 451B                            0.0s
 => => sha256:396b1da7636e2dcd10565cb4f2f952cbb4a8a38b58d3b86a2cacb172fb70117c 29.77MB / 29.77MB                     17.3s
 => => extracting sha256:396b1da7636e2dcd10565cb4f2f952cbb4a8a38b58d3b86a2cacb172fb70117c                             1.2s
 => [builder 1/4] FROM docker.io/library/rust:1.89@sha256:6e6d04bd50cd4c433a805c58c13f186a508c5b5417b9b61cae40ec28e  29.3s
 => => resolve docker.io/library/rust:1.89@sha256:6e6d04bd50cd4c433a805c58c13f186a508c5b5417b9b61cae40ec28e0593c51    0.0s
 => => sha256:981f4ce4cc1870d3623a4d7fddcf38ece12280919c2c3c3d4a1479abfdf25211 4.33kB / 4.33kB                        0.0s
 => => sha256:80b7316254b3093eb3c7ac44bb6c34bde013f27947c1ed8d8afe456b957ebfdb 49.28MB / 49.28MB                     13.4s
 => => sha256:36e4db86de6eba33869491caa7946b80dd71c255f1940e96a9f755cc2b1f3829 25.61MB / 25.61MB                      2.5s
 => => sha256:8ea45766c6449310ca2fc621a7e00bedb4b9b803a7fbfe2607efce6d2e07e435 67.78MB / 67.78MB                     15.7s
 => => sha256:6e6d04bd50cd4c433a805c58c13f186a508c5b5417b9b61cae40ec28e0593c51 7.72kB / 7.72kB                        0.0s
 => => sha256:251ea7e825dbb6f3073a5ce59bd4eb9ef562c92fc3c676165142cdecf1d10572 1.93kB / 1.93kB                        0.0s
 => => sha256:3cb1455cf185ce395d378e9a520710caec9909f11d6f9c69d28d3f73c50f2d23 235.80MB / 235.80MB                   15.4s
 => => extracting sha256:80b7316254b3093eb3c7ac44bb6c34bde013f27947c1ed8d8afe456b957ebfdb                             1.2s
 => => sha256:4695c4acb4a5e2014fcbbb31a005fb9091fbd4c32c921d7476c350a460817a67 209.43MB / 209.43MB                   26.4s
 => => extracting sha256:36e4db86de6eba33869491caa7946b80dd71c255f1940e96a9f755cc2b1f3829                             0.4s
 => => extracting sha256:8ea45766c6449310ca2fc621a7e00bedb4b9b803a7fbfe2607efce6d2e07e435                             1.8s
 => => extracting sha256:3cb1455cf185ce395d378e9a520710caec9909f11d6f9c69d28d3f73c50f2d23                             5.7s
 => => extracting sha256:4695c4acb4a5e2014fcbbb31a005fb9091fbd4c32c921d7476c350a460817a67                             2.7s
 => [internal] load build context                                                                                     0.0s
 => => transferring context: 53.55kB                                                                                  0.0s
 => [builder 2/4] WORKDIR /usr/src/health                                                                             0.1s
 => [builder 3/4] COPY . .                                                                                            0.1s
 => [builder 4/4] RUN cargo install --path .                                                                          0.5s
 => [stage-1 2/2] COPY --from=builder /usr/local/cargo/bin/health /usr/local/bin/health                               0.0s
 => exporting to image                                                                                                0.0s
 => => exporting layers                                                                                               0.0s
 => => writing image sha256:54b64bb9543b99fe1fcc92706fd653519852eab7163580684e100b646ddc83e3                          0.0s
 => => naming to docker.io/cvdg/health:0.1.0                                       

The builded docker image is about 80 MiB, a very small image.

Push to Docker Hub

$ docker push cvdg/health:0.1.0
The push refers to repository [docker.io/cvdg/health]
abcd4c02235b: Pushed 
e6a3842ebc7f: Mounted from library/debian 
0.1.0: digest: sha256:13513721bd57cbf9d4b44cc4450e64f6ac82b216f238934a4b6dbe438d06348a size: 738

The image is published on Docker Hub cvdg/health.

Run with podman

$ podman run cvdg/health:0.1.0
✔ docker.io/cvdg/health:0.1.0
Trying to pull docker.io/cvdg/health:0.1.0...
Getting image source signatures
Copying blob c40fa9182636 done   | 
Copying blob 396b1da7636e done   | 
Copying config 54b64bb954 done   | 
Writing manifest to image destination
Hello, world!

Health

At the moment it is only a Hello, World!, but every journey bigins with the first step.