mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-25 11:22:26 +00:00
ARMV7 Docker Image (#234)
* feat: Push dockerfile. Progress on trying to get armv7 image. * feat: Add Dockerfile. Using rust:slim as builder image. * refactor: Changes to build for armv7. * feat: Add .cargo config. Taken from: https://medium.com/swlh/compiling-rust-for-raspberry-pi-arm-922b55dbb050 * refactor: Add environment variable for linker. Instead of .cargo config file. * feat: Working cross compile version. For Armv7. * refactor: Clean up dockerfile. * refactor: Rename to armv7. Rename Dockerfile.armv7rust to Dockerfile.armv7. * feat: Add workflow to build ARMv7 docker image. * docs: Add armv7 deployment instructions.
This commit is contained in:
parent
5ab41c4e6e
commit
5418303b08
3 changed files with 85 additions and 1 deletions
43
Dockerfile.armv7
Normal file
43
Dockerfile.armv7
Normal file
|
@ -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 /libreddit
|
||||
|
||||
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 /libreddit/target/armv7-unknown-linux-musleabihf/release/libreddit /usr/local/bin/libreddit
|
||||
|
||||
# Use an unprivileged user.
|
||||
RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
|
||||
USER libreddit
|
||||
|
||||
# Tell Docker to expose port 8080
|
||||
EXPOSE 8080
|
||||
|
||||
# Run a healthcheck every minute to make sure Libreddit is functional
|
||||
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
|
||||
|
||||
CMD ["libreddit"]
|
Loading…
Add table
Add a link
Reference in a new issue