subhrajit-mohanty commited on
Commit
688cd08
·
verified ·
1 Parent(s): f128425

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -6
Dockerfile CHANGED
@@ -6,8 +6,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6
  gnupg \
7
  curl \
8
  ca-certificates \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
 
 
 
11
  # Install MinIO server and client
12
  RUN wget https://dl.min.io/server/minio/release/linux-amd64/minio \
13
  && chmod +x minio \
@@ -33,26 +38,36 @@ ENV AWS_SECRET_ACCESS_KEY=minioadmin
33
  ENV MLFLOW_S3_ENDPOINT_URL=http://localhost:9000
34
  ENV BUCKET_NAME=mlflow
35
 
36
- # Create directories
37
- RUN mkdir -p /tmp/minio-data /tmp/mlflow-data
 
 
 
 
 
 
 
 
 
 
38
 
39
  # Create a setup script
40
  RUN echo '#!/bin/bash \n\
41
- minio server /tmp/minio-data --console-address ":9001" & \n\
42
  sleep 5 \n\
43
  # Configure MinIO client and create bucket \n\
44
  mc alias set myminio http://localhost:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} \n\
45
  mc mb myminio/${BUCKET_NAME} --ignore-existing \n\
46
  # Start MLflow server with MinIO as artifact store \n\
47
  mlflow server \
48
- --backend-store-uri /tmp/mlflow-data \
49
  --default-artifact-root s3://${BUCKET_NAME}/ \
50
  --host 0.0.0.0 \
51
  --port 7860 \
52
- ' > /start.sh && chmod +x /start.sh
53
 
54
  # Expose ports
55
  EXPOSE 7860 9000 9001
56
 
57
  # Start services
58
- CMD ["/start.sh"]
 
6
  gnupg \
7
  curl \
8
  ca-certificates \
9
+ sudo \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Create a non-root user
13
+ RUN useradd -ms /bin/bash mlflowuser && \
14
+ echo "mlflowuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/mlflowuser
15
+
16
  # Install MinIO server and client
17
  RUN wget https://dl.min.io/server/minio/release/linux-amd64/minio \
18
  && chmod +x minio \
 
38
  ENV MLFLOW_S3_ENDPOINT_URL=http://localhost:9000
39
  ENV BUCKET_NAME=mlflow
40
 
41
+ # Create directories and set permissions
42
+ RUN mkdir -p /tmp/minio /tmp/mlflow && \
43
+ chown -R mlflowuser:mlflowuser /tmp && \
44
+ chmod -R 777 /tmp
45
+
46
+ # Create a home directory for mc config
47
+ RUN mkdir -p /home/mlflowuser/.mc && \
48
+ chown -R mlflowuser:mlflowuser /home/mlflowuser
49
+
50
+ # Switch to non-root user
51
+ USER mlflowuser
52
+ WORKDIR /home/mlflowuser
53
 
54
  # Create a setup script
55
  RUN echo '#!/bin/bash \n\
56
+ minio server /tmp/minio --console-address ":9001" & \n\
57
  sleep 5 \n\
58
  # Configure MinIO client and create bucket \n\
59
  mc alias set myminio http://localhost:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} \n\
60
  mc mb myminio/${BUCKET_NAME} --ignore-existing \n\
61
  # Start MLflow server with MinIO as artifact store \n\
62
  mlflow server \
63
+ --backend-store-uri /tmp/mlflow \
64
  --default-artifact-root s3://${BUCKET_NAME}/ \
65
  --host 0.0.0.0 \
66
  --port 7860 \
67
+ ' > /home/mlflowuser/start.sh && chmod +x /home/mlflowuser/start.sh
68
 
69
  # Expose ports
70
  EXPOSE 7860 9000 9001
71
 
72
  # Start services
73
+ CMD ["/home/mlflowuser/start.sh"]