Browse Source

Update docker to use python3 and add docker-compose

Gautier P 6 months ago
parent
commit
8f0e13fa6d
5 changed files with 19 additions and 26 deletions
  1. 3
    15
      .gitlab-ci.yml
  2. 4
    4
      docker/Dockerfile
  3. 11
    0
      docker/docker-compose.yml
  4. 1
    4
      flatisfy/data_files/__init__.py
  5. 0
    3
      requirements.txt

+ 3
- 15
.gitlab-ci.yml View File

@@ -1,29 +1,17 @@
1 1
 before_script:
2 2
   - "pip install -r requirements.txt"
3 3
   - "pip install pylint"
4
-  - "curl -sL https://deb.nodesource.com/setup_6.x | bash -"
4
+  - "curl -sL https://deb.nodesource.com/setup_10.x | bash -"
5 5
   - "apt-get install -y nodejs jq"
6 6
   - "npm install"
7 7
 
8
-lint:2.7:
9
-  image: "python:2.7"
10
-  stage: "test"
11
-  script:
12
-    - "hooks/pre-commit"
13
-
14
-lint:3:
8
+lint:
15 9
   image: "python:3"
16 10
   stage: "test"
17 11
   script:
18 12
     - "hooks/pre-commit"
19 13
 
20
-test:2.7:
21
-  image: "python:2.7"
22
-  stage: "test"
23
-  script:
24
-    - python -m flatisfy init-config | jq '.constraints.default.house_types = ["APART"] | .constraints.default.type = "RENT" | .constraints.default.postal_codes = ["75014"]' > /tmp/config.json
25
-    - python -m flatisfy test --config /tmp/config.json
26
-test:3:
14
+test:
27 15
   image: "python:3"
28 16
   stage: "test"
29 17
   script:

+ 4
- 4
docker/Dockerfile View File

@@ -1,4 +1,4 @@
1
-FROM python:2
1
+FROM python:3
2 2
 MAINTAINER Phyks <phyks@phyks.me>
3 3
 
4 4
 # Setup layout.
@@ -12,10 +12,10 @@ RUN apt-get update && \
12 12
 
13 13
 # Install latest pip and python dependencies.
14 14
 RUN pip install -U setuptools && \
15
-    pip install html2text simplejson BeautifulSoup
15
+    pip install html2text simplejson beautifulsoup4
16 16
 
17 17
 # Install node.js.
18
-RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
18
+RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
19 19
     && apt-get install -y nodejs
20 20
 
21 21
 # Install weboob's code itself.
@@ -30,7 +30,7 @@ COPY ./*.sh /home/user/
30 30
 
31 31
 # Install Flatisfy, set up directories and permissions.
32 32
 RUN cd /home/user \
33
-    && git clone https://framagit.org/phyks/Flatisfy/ ./app \
33
+    && git clone https://framagit.org/phyks/Flatisfy.git/ ./app \
34 34
     && cd ./app \
35 35
     && pip install -r requirements.txt \
36 36
     && npm install \

+ 11
- 0
docker/docker-compose.yml View File

@@ -0,0 +1,11 @@
1
+version: "3"
2
+services:
3
+  app:
4
+    build: .
5
+    # image: phyks/flatisfy
6
+    environment:
7
+      - LOCAL_USER_ID=1000
8
+    volumes:
9
+      - ./data:/flatisfy
10
+    ports:
11
+      - "8080:8080"

+ 1
- 4
flatisfy/data_files/__init__.py View File

@@ -16,10 +16,7 @@ from flatisfy.models.postal_code import PostalCode
16 16
 from flatisfy.models.public_transport import PublicTransport
17 17
 from flatisfy.tools import normalize_string
18 18
 
19
-if sys.version_info >= (3, 0):
20
-    import csv
21
-else:
22
-    from backports import csv
19
+import csv
23 20
 
24 21
 
25 22
 LOGGER = logging.getLogger(__name__)

+ 0
- 3
requirements.txt View File

@@ -1,12 +1,9 @@
1 1
 alembic
2 2
 appdirs
3 3
 arrow
4
-backports.csv; python_version < '3.0'
5 4
 bottle
6 5
 bottle-sqlalchemy
7 6
 canister
8
-enum34; python_version < '3.4'
9
-functools32; python_version < '3.2.3'
10 7
 future
11 8
 imagehash
12 9
 mapbox