vkt1414 commited on
Commit
7365880
1 Parent(s): 5b4b3c3

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +50 -0
Dockerfile ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.12.3
3
+
4
+ # Set up a new user named "user" with user ID 1000
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Switch to the "user" user
8
+ USER user
9
+
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Set the working directory to the user's home directory
15
+ WORKDIR $HOME/app
16
+
17
+ # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
18
+ RUN pip install --no-cache-dir --upgrade pip
19
+
20
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
21
+ COPY --chown=user . $HOME/app
22
+
23
+ # Install any needed packages specified in requirements.txt
24
+ RUN pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Install Apache Superset
27
+ RUN pip install apache-superset
28
+
29
+ # Initialize the database
30
+ RUN superset db upgrade
31
+
32
+ # Create an admin user
33
+ RUN export FLASK_APP=superset && flask fab create-admin \
34
+ --username admin \
35
+ --firstname Admin \
36
+ --lastname User \
37
+ --email admin@superset.com \
38
+ --password admin
39
+
40
+ # Load some data to play with
41
+ RUN superset load_examples
42
+
43
+ # Create default roles and permissions
44
+ RUN superset init
45
+
46
+ # Make port 8088 available to the world outside this container
47
+ EXPOSE 8088
48
+
49
+ # Run superset when the container launches
50
+ CMD ["superset", "run", "-p", "8088", "--with-threads", "--reload"]