1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-26 23:58:35 -06:00

Compare commits

...

4 commits

Author SHA1 Message Date
Sayantan Santra
0d0da1141b
Merge pull request #27 from yilmaz08/main
Fix simple dockerfile errors
2024-08-28 11:49:51 -05:00
4a8b62446c
fix: Case mismatch 2024-08-28 11:37:45 -05:00
Abdürrahim YILMAZ
855145d4d7 fix: argument was not being passed
Argument was not being passed, although it is declared. So changed to a
static path in "FROM scratch" part

Error message before the fix:

Step 17/19 : COPY --from=builder
/chhoto-url/target/$target/release/chhoto-url /chhoto-url
COPY failed: stat chhoto-url/target//release/chhoto-url: file does not
exist
2024-08-28 03:12:33 +03:00
Abdürrahim YILMAZ
59f679a1c2 fix: copy destination path
Error message before the fix:

Step 4/19 : COPY ./actix/Cargo.toml ./actix/Cargo.lock .

When using COPY with more than one source file, the destination must be
a directory and end with a /
2024-08-28 03:04:37 +03:00
2 changed files with 9 additions and 8 deletions

View file

@ -4,12 +4,12 @@
FROM lukemathwalker/cargo-chef:latest-rust-slim AS chef FROM lukemathwalker/cargo-chef:latest-rust-slim AS chef
WORKDIR /chhoto-url WORKDIR /chhoto-url
FROM chef as planner FROM chef AS planner
COPY ./actix/Cargo.toml ./actix/Cargo.lock . COPY ./actix/Cargo.toml ./actix/Cargo.lock ./
COPY ./actix/src ./src COPY ./actix/src ./src
RUN cargo chef prepare --recipe-path recipe.json RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder FROM chef AS builder
ARG target=x86_64-unknown-linux-musl ARG target=x86_64-unknown-linux-musl
RUN apt-get update && apt-get install -y musl-tools RUN apt-get update && apt-get install -y musl-tools
RUN rustup target add $target RUN rustup target add $target
@ -18,12 +18,13 @@ COPY --from=planner /chhoto-url/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer # Build dependencies - this is the caching Docker layer
RUN cargo chef cook --release --target=$target --recipe-path recipe.json RUN cargo chef cook --release --target=$target --recipe-path recipe.json
COPY ./actix/Cargo.toml ./actix/Cargo.lock . COPY ./actix/Cargo.toml ./actix/Cargo.lock ./
COPY ./actix/src ./src COPY ./actix/src ./src
# Build application # Build application
RUN cargo build --release --target=$target --locked --bin chhoto-url RUN cargo build --release --target=$target --locked --bin chhoto-url
RUN cp /chhoto-url/target/$target/release/chhoto-url /chhoto-url/release
FROM scratch FROM scratch
COPY --from=builder /chhoto-url/target/$target/release/chhoto-url /chhoto-url COPY --from=builder /chhoto-url/release /chhoto-url
COPY ./resources /resources COPY ./resources /resources
ENTRYPOINT ["/chhoto-url"] ENTRYPOINT ["/chhoto-url"]

View file

@ -1,13 +1,13 @@
# SPDX-FileCopyrightText: 2023 Sayantan Santra <sayantan.santra689@gmail.com> # SPDX-FileCopyrightText: 2023 Sayantan Santra <sayantan.santra689@gmail.com>
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
FROM scratch as builder-amd64 FROM scratch AS builder-amd64
COPY ./actix/target/x86_64-unknown-linux-musl/release/chhoto-url /chhoto-url COPY ./actix/target/x86_64-unknown-linux-musl/release/chhoto-url /chhoto-url
FROM scratch as builder-arm64 FROM scratch AS builder-arm64
COPY ./actix/target/aarch64-unknown-linux-musl/release/chhoto-url /chhoto-url COPY ./actix/target/aarch64-unknown-linux-musl/release/chhoto-url /chhoto-url
FROM scratch as builder-arm FROM scratch AS builder-arm
COPY ./actix/target/armv7-unknown-linux-musleabihf/release/chhoto-url /chhoto-url COPY ./actix/target/armv7-unknown-linux-musleabihf/release/chhoto-url /chhoto-url
ARG TARGETARCH ARG TARGETARCH