mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-23 09:30:57 +00:00
Update Dockerfile
Try cloning repo for build and transfer
This commit is contained in:
parent
03145dc87c
commit
82917f9214
1 changed files with 18 additions and 7 deletions
25
Dockerfile
25
Dockerfile
|
@ -1,17 +1,25 @@
|
|||
FROM alpine:3.19
|
||||
|
||||
ARG TARGET=x86_64-unknown-linux-musl
|
||||
# Set build arguments
|
||||
ARG TARGET
|
||||
ARG BUILD_DIR=/build
|
||||
|
||||
RUN apk add --no-cache curl build-base cmake
|
||||
# Install required dependencies
|
||||
RUN apk add --no-cache \
|
||||
curl \
|
||||
git \
|
||||
build-base \
|
||||
cmake
|
||||
|
||||
# Download the latest source code from the main branch
|
||||
RUN mkdir -p ${BUILD_DIR} && \
|
||||
curl -L "https://github.com/LucifersCircle/redlib/archive/refs/heads/main.tar.gz" | \
|
||||
tar --strip-components=1 -xz -C ${BUILD_DIR}
|
||||
# Clone the repository and checkout the main branch
|
||||
RUN git clone https://github.com/LucifersCircle/redlib.git ${BUILD_DIR} && \
|
||||
cd ${BUILD_DIR} && \
|
||||
git checkout main
|
||||
|
||||
# Build the binary
|
||||
# Build the project
|
||||
WORKDIR ${BUILD_DIR}
|
||||
|
||||
# Run cmake to configure and make to build the project
|
||||
RUN cmake -DCMAKE_BUILD_TYPE=Release -DTARGET=${TARGET} . && \
|
||||
make
|
||||
|
||||
|
@ -21,11 +29,14 @@ RUN mv ${BUILD_DIR}/target/${TARGET}/redlib /usr/local/bin/redlib
|
|||
# Clean up build dependencies
|
||||
RUN apk del build-base cmake && rm -rf ${BUILD_DIR}
|
||||
|
||||
# Add a non-root user for security
|
||||
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
|
||||
USER redlib
|
||||
|
||||
# Expose port 8080
|
||||
EXPOSE 8080
|
||||
|
||||
# Healthcheck to ensure redlib is functional
|
||||
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider -q http://localhost:8080/settings || exit 1
|
||||
|
||||
CMD ["redlib"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue