mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-23 17:40:58 +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
|
FROM alpine:3.19
|
||||||
|
|
||||||
ARG TARGET=x86_64-unknown-linux-musl
|
# Set build arguments
|
||||||
|
ARG TARGET
|
||||||
ARG BUILD_DIR=/build
|
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
|
# Clone the repository and checkout the main branch
|
||||||
RUN mkdir -p ${BUILD_DIR} && \
|
RUN git clone https://github.com/LucifersCircle/redlib.git ${BUILD_DIR} && \
|
||||||
curl -L "https://github.com/LucifersCircle/redlib/archive/refs/heads/main.tar.gz" | \
|
cd ${BUILD_DIR} && \
|
||||||
tar --strip-components=1 -xz -C ${BUILD_DIR}
|
git checkout main
|
||||||
|
|
||||||
# Build the binary
|
# Build the project
|
||||||
WORKDIR ${BUILD_DIR}
|
WORKDIR ${BUILD_DIR}
|
||||||
|
|
||||||
|
# Run cmake to configure and make to build the project
|
||||||
RUN cmake -DCMAKE_BUILD_TYPE=Release -DTARGET=${TARGET} . && \
|
RUN cmake -DCMAKE_BUILD_TYPE=Release -DTARGET=${TARGET} . && \
|
||||||
make
|
make
|
||||||
|
|
||||||
|
@ -21,11 +29,14 @@ RUN mv ${BUILD_DIR}/target/${TARGET}/redlib /usr/local/bin/redlib
|
||||||
# Clean up build dependencies
|
# Clean up build dependencies
|
||||||
RUN apk del build-base cmake && rm -rf ${BUILD_DIR}
|
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
|
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
|
||||||
USER redlib
|
USER redlib
|
||||||
|
|
||||||
|
# Expose port 8080
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Healthcheck to ensure redlib is functional
|
||||||
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider -q http://localhost:8080/settings || exit 1
|
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider -q http://localhost:8080/settings || exit 1
|
||||||
|
|
||||||
CMD ["redlib"]
|
CMD ["redlib"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue