Browse Source

Update docker to use python3 and add docker-compose

master
Gautier P 1 year ago
parent
commit
8f0e13fa6d
  1. 18
      .gitlab-ci.yml
  2. 8
      docker/Dockerfile
  3. 11
      docker/docker-compose.yml
  4. 5
      flatisfy/data_files/__init__.py
  5. 3
      requirements.txt

18
.gitlab-ci.yml

@ -1,29 +1,17 @@ @@ -1,29 +1,17 @@
before_script:
- "pip install -r requirements.txt"
- "pip install pylint"
- "curl -sL https://deb.nodesource.com/setup_6.x | bash -"
- "curl -sL https://deb.nodesource.com/setup_10.x | bash -"
- "apt-get install -y nodejs jq"
- "npm install"
lint:2.7:
image: "python:2.7"
stage: "test"
script:
- "hooks/pre-commit"
lint:3:
lint:
image: "python:3"
stage: "test"
script:
- "hooks/pre-commit"
test:2.7:
image: "python:2.7"
stage: "test"
script:
- python -m flatisfy init-config | jq '.constraints.default.house_types = ["APART"] | .constraints.default.type = "RENT" | .constraints.default.postal_codes = ["75014"]' > /tmp/config.json
- python -m flatisfy test --config /tmp/config.json
test:3:
test:
image: "python:3"
stage: "test"
script:

8
docker/Dockerfile

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

11
docker/docker-compose.yml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
version: "3"
services:
app:
build: .
# image: phyks/flatisfy
environment:
- LOCAL_USER_ID=1000
volumes:
- ./data:/flatisfy
ports:
- "8080:8080"

5
flatisfy/data_files/__init__.py

@ -16,10 +16,7 @@ from flatisfy.models.postal_code import PostalCode @@ -16,10 +16,7 @@ from flatisfy.models.postal_code import PostalCode
from flatisfy.models.public_transport import PublicTransport
from flatisfy.tools import normalize_string
if sys.version_info >= (3, 0):
import csv
else:
from backports import csv
import csv
LOGGER = logging.getLogger(__name__)

3
requirements.txt

@ -1,12 +1,9 @@ @@ -1,12 +1,9 @@
alembic
appdirs
arrow
backports.csv; python_version < '3.0'
bottle
bottle-sqlalchemy
canister
enum34; python_version < '3.4'
functools32; python_version < '3.2.3'
future
imagehash
mapbox

Loading…
Cancel
Save