Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Torrust Index

## Builder Image
FROM rust:bookworm as chef
FROM rust:bookworm AS chef
WORKDIR /tmp
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN cargo binstall --no-confirm cargo-chef cargo-nextest

## Tester Image
FROM rust:slim-bookworm as tester
FROM rust:slim-bookworm AS tester
WORKDIR /tmp

RUN apt-get update; apt-get install -y curl sqlite3; apt-get autoclean
Expand All @@ -21,7 +21,7 @@ RUN mkdir -p /app/share/torrust/default/database/; \
sqlite3 /app/share/torrust/default/database/index.sqlite3.db "VACUUM;"

## Su Exe Compile
FROM docker.io/library/gcc:bookworm as gcc
FROM docker.io/library/gcc:bookworm AS gcc
COPY ./contrib/dev-tools/su-exec/ /usr/local/src/su-exec/
RUN cc -Wall -Werror -g /usr/local/src/su-exec/su-exec.c -o /usr/local/bin/su-exec; chmod +x /usr/local/bin/su-exec

Expand Down Expand Up @@ -62,7 +62,7 @@ RUN cargo nextest archive --tests --benches --examples --workspace --all-targets


# Extract and Test (debug)
FROM tester as test_debug
FROM tester AS test_debug
WORKDIR /test
COPY . /test/src/
COPY --from=build_debug \
Expand All @@ -76,7 +76,7 @@ RUN mkdir -p /app/bin/; cp -l /test/src/target/debug/torrust-index /app/bin/torr
RUN chown -R root:root /app; chmod -R u=rw,go=r,a+X /app; chmod -R a+x /app/bin

# Extract and Test (release)
FROM tester as test
FROM tester AS test
WORKDIR /test
COPY . /test/src
COPY --from=build \
Expand All @@ -93,7 +93,7 @@ RUN chown -R root:root /app; chmod -R u=rw,go=r,a+X /app; chmod -R a+x /app/bin


## Runtime
FROM gcr.io/distroless/cc-debian12:debug as runtime
FROM gcr.io/distroless/cc-debian12:debug AS runtime
RUN ["/busybox/cp", "-sp", "/busybox/sh","/busybox/cat","/busybox/ls","/busybox/env", "/bin/"]
COPY --from=gcc --chmod=0555 /usr/local/bin/su-exec /bin/su-exec

Expand Down Expand Up @@ -124,14 +124,14 @@ ENTRYPOINT ["/usr/local/bin/entry.sh"]


## Torrust-Index (debug)
FROM runtime as debug
FROM runtime AS debug
ENV RUNTIME="debug"
COPY --from=test_debug /app/ /usr/
RUN env
CMD ["sh"]

## Torrust-Index (release) (default)
FROM runtime as release
FROM runtime AS release
ENV RUNTIME="release"
COPY --from=test /app/ /usr/
HEALTHCHECK --interval=5s --timeout=5s --start-period=3s --retries=3 \
Expand Down