diff options
| author | Fuwn <[email protected]> | 2022-04-19 20:46:01 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-19 20:46:01 -0700 |
| commit | 801411024629f8ab6d6a161f7c4ba3be68556c91 (patch) | |
| tree | 221bb1103b0abe0820f49853680482ef450b0703 | |
| parent | fix(route): remove debug logs (diff) | |
| download | locus-801411024629f8ab6d6a161f7c4ba3be68556c91.tar.xz locus-801411024629f8ab6d6a161f7c4ba3be68556c91.zip | |
ci(docker): fix image
For some unknown reason, -- after adding the new dependencies required for
the proper search engine which was implemented in the previous commits
-- the Docker image had stoped working. This is me fixing the Docker
image.
| -rw-r--r-- | .dockerignore | 2 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Dockerfile | 49 | ||||
| -rw-r--r-- | Makefile.toml | 2 |
4 files changed, 26 insertions, 28 deletions
diff --git a/.dockerignore b/.dockerignore index a248225..3c0803c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,11 +1,9 @@ # Rust target/ -Cargo.lock # IDE .idea/ # Development *.pem -*.db .locus/ @@ -7,5 +7,4 @@ Cargo.lock # Development *.pem -*.db .locus/ @@ -1,41 +1,42 @@ -FROM rust:latest as builder +FROM clux/muslrust:nightly-2022-04-16 AS environment -RUN update-ca-certificates +ENV CHANNEL=nightly-2022-04-16 -# ENV USER=locus -# ENV UID=10001 +RUN curl "https://static.rust-lang.org/rustup/archive/${RUSTUP_VER}/${RUST_ARCH}/rustup-init" -o rustup-init \ + && chmod +x rustup-init \ + && ./rustup-init -y --default-toolchain ${CHANNEL} --profile minimal \ + && rm rustup-init \ + && ~/.cargo/bin/rustup target add x86_64-unknown-linux-musl \ + && echo "[build]\ntarget = \"x86_64-unknown-linux-musl\"" > ~/.cargo/config -# RUN adduser \ -# --disabled-password \ -# --gecos "" \ -# --home "/nonexistent" \ -# --shell "/sbin/nologin" \ -# --no-create-home \ -# --uid "${UID}" \ -# "${USER}" +FROM environment as builder -WORKDIR /locus +WORKDIR /usr/src -COPY ./ ./ +RUN cargo new locus -RUN cargo build --release +WORKDIR /usr/src/locus -RUN strip -s /locus/target/release/locus +COPY Cargo.* . + +RUN cargo build --release -FROM debian:buster-slim +COPY . . -RUN apt-get update && apt-get install -y libssl-dev +RUN --mount=type=cache,target=/usr/src/locus/target \ + --mount=type=cache,target=/root/.cargo/registry \ + cargo build --release --bin locus \ + && strip -s /usr/src/locus/target/x86_64-unknown-linux-musl/release/locus \ + && mv /usr/src/locus/target/x86_64-unknown-linux-musl/release/locus . -COPY --from=builder /etc/passwd /etc/passwd -COPY --from=builder /etc/group /etc/group +FROM gcr.io/distroless/static:nonroot WORKDIR /locus -COPY --from=builder /locus/target/release/locus ./ -COPY --from=builder /locus/content ./content +COPY --from=builder --chown=nonroot:nonroot /usr/src/locus/locus . -# USER locus:locus +COPY --from=builder --chown=nonroot:nonroot /usr/src/locus/content ./content EXPOSE 1965 -CMD ["./locus"] +ENTRYPOINT ["/locus/locus"] diff --git a/Makefile.toml b/Makefile.toml index 5596640..cdca5d7 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -56,4 +56,4 @@ args = ["run", "--", "{@}"] [tasks.docker-build] dependencies = ["checkfc"] command = "docker" -args = ["build", "-t", "fuwn/locus", "."] +args = ["build", "-t", "fuwn/locus:latest", "."] |