Spaces:
Running
Running
# Build stage | |
FROM golang:1.18 AS builder | |
WORKDIR /app | |
# Clone the repository | |
RUN git clone https://github.com/cloudreve/Cloudreve.git . | |
# Copy custom files | |
COPY migration.go /app/models/migration.go | |
# Build the application | |
RUN go mod tidy && go build -o cloudreve | |
# Final stage | |
FROM debian:buster-slim | |
# Install aria2 | |
RUN apt-get update && apt-get install -y aria2 && rm -rf /var/lib/apt/lists/* | |
# Create necessary directories | |
RUN mkdir -p /app \ | |
&& mkdir -p /aria2/data \ | |
&& chmod 777 /aria2/data \ | |
&& chmod 777 /app | |
# Copy the built executable from the builder stage | |
COPY --from=builder /app/cloudreve /app/ | |
# Copy configuration files and scripts | |
COPY aria2.conf /app/aria2.conf | |
COPY start.sh /app/start.sh | |
# Set permissions | |
RUN chmod +x /app/cloudreve /app/start.sh | |
WORKDIR /app | |
EXPOSE 5212 | |
CMD ["/app/start.sh"] |