fix Dockerfile

This commit is contained in:
loverustfs
2025-06-29 17:08:44 +08:00
committed by GitHub
parent f46ffd8885
commit 3fbbde4897
+6 -10
View File
@@ -10,18 +10,16 @@ RUN apk add --no-cache \
RUN addgroup -g 1000 rustfs && \ RUN addgroup -g 1000 rustfs && \
adduser -D -s /bin/sh -u 1000 -G rustfs rustfs adduser -D -s /bin/sh -u 1000 -G rustfs rustfs
WORKDIR /app
# Create data directories # Create data directories
RUN mkdir -p /data/rustfs{0,1,2,3} && \ RUN mkdir -p /data/rustfs && \
chown -R rustfs:rustfs /data /app chown -R rustfs:rustfs /data
# Copy binary based on target architecture # Copy binary based on target architecture
COPY --chown=rustfs:rustfs \ COPY --chown=rustfs:rustfs \
target/*/release/rustfs \ target/*/release/rustfs \
/app/rustfs /usr/local/bin/rustfs
RUN chmod +x /app/rustfs RUN chmod +x /usr/local/bin/rustfs
# Switch to non-root user # Switch to non-root user
USER rustfs USER rustfs
@@ -29,9 +27,7 @@ USER rustfs
# Expose ports # Expose ports
EXPOSE 9000 9001 EXPOSE 9000 9001
# Health check VOLUME /data
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:9000/health || exit 1
# Set default command # Set default command
CMD ["/app/rustfs"] CMD ["rustfs", "/data"]