chore: adjust docker files
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
# docker/Dockerfile
|
||||
|
||||
# ==============================================================================
|
||||
# STAGE 1: Build
|
||||
# ==============================================================================
|
||||
@ -10,26 +8,24 @@ RUN apk add --no-cache musl-dev gcc
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 1. Create a dummy binary project.
|
||||
# 1. Create a dummy binary project for dependency caching.
|
||||
RUN mkdir src
|
||||
RUN echo "fn main() {}" > src/main.rs
|
||||
|
||||
# 2. Copy the dependency manifests.
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
# 3. Build the dependencies. This will compile all dependencies from
|
||||
# Cargo.lock and the empty main.rs.
|
||||
# 3. Build the dependencies.
|
||||
RUN cargo build --release
|
||||
|
||||
# 4. Now, copy the actual application source code.
|
||||
COPY src ./src
|
||||
|
||||
# 5. Build the real application. This will be very fast as all dependencies
|
||||
# are already compiled and cached.
|
||||
# 5. Build the real application.
|
||||
RUN cargo build --release
|
||||
|
||||
# ==============================================================================
|
||||
# STAGE 2: Create the final, minimal production image
|
||||
# STAGE 2: Create the final production image
|
||||
# ==============================================================================
|
||||
FROM alpine:3.22 AS final
|
||||
|
||||
@ -52,9 +48,9 @@ COPY --from=builder /app/target/release/sb-ruleset-sync /usr/local/bin/ruleset-s
|
||||
COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Create necessary directories and set ownership
|
||||
# Create necessary directories and set ownership for volumes
|
||||
RUN mkdir -p /config /rules && \
|
||||
chown -R app:app /rules
|
||||
chown -R app:app /config /rules
|
||||
|
||||
# Set the entrypoint for the container
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
Reference in New Issue
Block a user