forked from redlib-org/redlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Container pipeline overhaul (redlib-org#59)"
This reverts commit 3f4526d.
- Loading branch information
1 parent
023cc85
commit b69d48c
Showing
5 changed files
with
146 additions
and
181 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#################################################################################################### | ||
## Builder | ||
#################################################################################################### | ||
FROM rust:alpine AS builder | ||
|
||
RUN apk add --no-cache g++ git | ||
|
||
WORKDIR /usr/src/redlib | ||
|
||
# cache dependencies in their own layer | ||
COPY Cargo.lock Cargo.toml . | ||
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo install --config net.git-fetch-with-cli=true --path . && rm -rf ./src | ||
|
||
COPY . . | ||
|
||
# net.git-fetch-with-cli is specified in order to prevent a potential OOM kill | ||
# in low memory environments. See: | ||
# https://users.rust-lang.org/t/cargo-uses-too-much-memory-being-run-in-qemu/76531 | ||
# This is tracked under issue #641. This also requires us to install git in the | ||
# builder. | ||
RUN cargo install --config net.git-fetch-with-cli=true --path . | ||
|
||
#################################################################################################### | ||
## Final image | ||
#################################################################################################### | ||
FROM alpine:latest | ||
|
||
# Import ca-certificates from builder | ||
COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates | ||
COPY --from=builder /etc/ssl/certs /etc/ssl/certs | ||
|
||
# Copy our build | ||
COPY --from=builder /usr/local/cargo/bin/redlib /usr/local/bin/redlib | ||
|
||
# Use an unprivileged user. | ||
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib | ||
USER redlib | ||
|
||
# Tell Docker to expose port 8080 | ||
EXPOSE 8080 | ||
|
||
# Run a healthcheck every minute to make sure redlib is functional | ||
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1 | ||
|
||
CMD ["redlib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#################################################################################################### | ||
## Builder | ||
#################################################################################################### | ||
FROM --platform=$BUILDPLATFORM rust:slim AS builder | ||
|
||
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-gnueabihf-gcc | ||
ENV CC_armv7_unknown_linux_musleabihf=arm-linux-gnueabihf-gcc | ||
|
||
RUN apt-get update && apt-get -y install gcc-arm-linux-gnueabihf \ | ||
binutils-arm-linux-gnueabihf \ | ||
musl-tools | ||
|
||
RUN rustup target add armv7-unknown-linux-musleabihf | ||
|
||
WORKDIR /redlib | ||
|
||
COPY . . | ||
|
||
RUN cargo build --target armv7-unknown-linux-musleabihf --release | ||
|
||
#################################################################################################### | ||
## Final image | ||
#################################################################################################### | ||
FROM alpine:latest | ||
|
||
# Import ca-certificates from builder | ||
COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates | ||
COPY --from=builder /etc/ssl/certs /etc/ssl/certs | ||
|
||
# Copy our build | ||
COPY --from=builder /redlib/target/armv7-unknown-linux-musleabihf/release/redlib /usr/local/bin/redlib | ||
|
||
# Use an unprivileged user. | ||
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib | ||
USER redlib | ||
|
||
# Tell Docker to expose port 8080 | ||
EXPOSE 8080 | ||
|
||
# Run a healthcheck every minute to make sure redlib is functional | ||
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1 | ||
|
||
CMD ["redlib"] |