johnpaulbin commited on
Commit
044093c
·
1 Parent(s): 7b871fe

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -13
Dockerfile CHANGED
@@ -1,28 +1,36 @@
1
- # Using python:3.9 as a base image
2
  FROM python:3.9
3
 
4
- # Setting up the necessary packages and dependencies
 
 
 
 
 
 
5
  RUN apt-get update && \
6
  apt-get install -y libpcre++-dev qttools5-dev qtbase5-dev libqt5svg5-dev libarchive-dev libpcre2-dev wget && \
7
  wget https://github.com/XapaJIaMnu/translateLocally/releases/download/latest/translateLocally-v0.0.2+136745e-Ubuntu-20.04.AVX.deb && \
8
  dpkg -i translateLocally-v0.0.2+136745e-Ubuntu-20.04.AVX.deb || true && \
9
- apt-get install -f -y
 
10
 
11
- # Setting up the working directory and adding a new user named "user"
12
- WORKDIR /home/user/app
13
- RUN useradd -m -u 1000 user
14
 
15
- # Switching to the "user" user and setting environment variables
 
 
16
  USER user
 
17
  ENV HOME=/home/user \
18
- PATH=/home/user/.local/bin:$PATH
19
 
20
- # Installing the requirements
21
- COPY requirements.txt .
22
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
23
 
24
- # Copying the current directory contents into the container
25
- COPY --chown=user . .
26
 
27
  # Running the Flask application
28
  CMD ["python", "app.py"]
 
1
+ # Use the official Python 3.9 image
2
  FROM python:3.9
3
 
4
+ # Set the working directory to /code
5
+ WORKDIR /code
6
+
7
+ # Copy the current directory contents into the container at /code
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ # Install necessary Ubuntu packages and a deb package from a URL
11
  RUN apt-get update && \
12
  apt-get install -y libpcre++-dev qttools5-dev qtbase5-dev libqt5svg5-dev libarchive-dev libpcre2-dev wget && \
13
  wget https://github.com/XapaJIaMnu/translateLocally/releases/download/latest/translateLocally-v0.0.2+136745e-Ubuntu-20.04.AVX.deb && \
14
  dpkg -i translateLocally-v0.0.2+136745e-Ubuntu-20.04.AVX.deb || true && \
15
+ apt-get install -f -y && \
16
+ rm translateLocally-v0.0.2+136745e-Ubuntu-20.04.AVX.deb
17
 
18
+ # Install requirements.txt
19
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
20
 
21
+ # Set up a new user named "user" with user ID 1000
22
+ RUN useradd -m -u 1000 user
23
+ # Switch to the "user" user
24
  USER user
25
+ # Set home to the user's home directory
26
  ENV HOME=/home/user \
27
+ PATH=/home/user/.local/bin:$PATH
28
 
29
+ # Set the working directory to the user's home directory
30
+ WORKDIR $HOME/app
 
31
 
32
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
33
+ COPY --chown=user . $HOME/app
34
 
35
  # Running the Flask application
36
  CMD ["python", "app.py"]