danyoung commited on
Commit
5a2ad83
1 Parent(s): dcc5799

Tried adding user permissions

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -2
  2. app/app.py +1 -1
Dockerfile CHANGED
@@ -19,11 +19,15 @@ COPY requirements.txt .
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
  pip install --no-cache-dir -r requirements.txt
21
 
 
 
 
 
22
  # Copy source files over
23
- COPY . .
24
 
25
  # Expose Flask (Dash) port
26
- EXPOSE 4057
27
 
28
  # Run main UI
29
  ENTRYPOINT ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "45", "app.app:server"]
 
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
  pip install --no-cache-dir -r requirements.txt
21
 
22
+ # To get permissions to write to the container
23
+ RUN useradd -m -u 1000 user
24
+ USER user
25
+
26
  # Copy source files over
27
+ COPY --chown=user . .
28
 
29
  # Expose Flask (Dash) port
30
+ EXPOSE 7860
31
 
32
  # Run main UI
33
  ENTRYPOINT ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "45", "app.app:server"]
app/app.py CHANGED
@@ -28,7 +28,7 @@ server = app.server
28
  df = pd.read_csv(constants.DATA_FILE_PATH, index_col=constants.INDEX_COLS)
29
 
30
  cache_dir = os.path.join(os.path.dirname(__file__), "../cache_dir")
31
- os.mkdir(cache_dir)
32
  regionmask.set_options(cache_dir=cache_dir)
33
  countries_df = regionmask.defined_regions.natural_earth_v5_0_0.countries_110.to_dataframe()
34
 
 
28
  df = pd.read_csv(constants.DATA_FILE_PATH, index_col=constants.INDEX_COLS)
29
 
30
  cache_dir = os.path.join(os.path.dirname(__file__), "../cache_dir")
31
+ os.makedirs(cache_dir)
32
  regionmask.set_options(cache_dir=cache_dir)
33
  countries_df = regionmask.defined_regions.natural_earth_v5_0_0.countries_110.to_dataframe()
34