Merge pull request #374 from SamR1/update-docker-files
Docker - install fittrackee in a virtualenv
This commit is contained in:
commit
6eed1e61f6
@ -8,13 +8,12 @@ WORKDIR /usr/src/app
|
||||
COPY . /usr/src/app
|
||||
|
||||
# install requirements
|
||||
ENV VIRTUAL_ENV=/opt/venv
|
||||
RUN python3 -m venv $VIRTUAL_ENV
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install poetry
|
||||
RUN poetry config virtualenvs.create false
|
||||
RUN poetry install --no-interaction --quiet
|
||||
|
||||
# create uploads folder
|
||||
CMD mkdir /usr/src/app/uploads
|
||||
RUN . $VIRTUAL_ENV/bin/activate && poetry install --no-interaction --quiet
|
||||
|
||||
# run fittrackee server
|
||||
CMD flask run --with-threads -h 0.0.0.0
|
12
Makefile
12
Makefile
@ -43,7 +43,7 @@ clean-install: clean
|
||||
|
||||
## Docker commands for evaluation purposes
|
||||
docker-bandit:
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_BANDIT) -r fittrackee -c pyproject.toml
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee bandit -r fittrackee -c pyproject.toml
|
||||
|
||||
docker-build:
|
||||
docker-compose -f docker-compose-dev.yml build fittrackee
|
||||
@ -56,7 +56,7 @@ docker-build-client:
|
||||
docker-check-all: docker-bandit docker-lint-all docker-type-check docker-test-client docker-test-python
|
||||
|
||||
docker-downgrade-db:
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_FLASK) db downgrade --directory $(DOCKER_MIGRATIONS)
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee flask db downgrade --directory $(DOCKER_MIGRATIONS)
|
||||
|
||||
docker-init: docker-run docker-init-db docker-restart docker-run-workers
|
||||
|
||||
@ -76,7 +76,7 @@ docker-logs:
|
||||
docker-compose -f docker-compose-dev.yml logs --follow
|
||||
|
||||
docker-migrate-db:
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_FLASK) db migrate --directory $(DOCKER_MIGRATIONS)
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee flask db migrate --directory $(DOCKER_MIGRATIONS)
|
||||
|
||||
docker-rebuild:
|
||||
docker-compose -f docker-compose-dev.yml build --no-cache
|
||||
@ -86,7 +86,7 @@ docker-restart:
|
||||
docker-compose -f docker-compose-dev.yml exec -d fittrackee docker/run-workers.sh
|
||||
|
||||
docker-revision:
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_FLASK) db revision --directory $(DOCKER_MIGRATIONS) --message $(MIGRATION_MESSAGE)
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee flask db revision --directory $(DOCKER_MIGRATIONS) --message $(MIGRATION_MESSAGE)
|
||||
|
||||
docker-run-all: docker-run docker-run-workers
|
||||
|
||||
@ -123,13 +123,13 @@ docker-test-python: docker-run
|
||||
|
||||
docker-type-check:
|
||||
echo 'Running mypy in docker...'
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_MYPY) fittrackee
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee mypy fittrackee
|
||||
|
||||
docker-up:
|
||||
docker-compose -f docker-compose-dev.yml up fittrackee
|
||||
|
||||
docker-upgrade-db:
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_FTCLI) db upgrade
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee ftcli db upgrade
|
||||
|
||||
downgrade-db:
|
||||
$(FLASK) db downgrade --directory $(MIGRATIONS)
|
||||
|
@ -31,10 +31,6 @@ FTCLI = $(VENV)/bin/ftcli
|
||||
# Docker env
|
||||
export DOCKER_APP_DIR = /usr/src/app
|
||||
export DOCKER_MIGRATIONS = $(DOCKER_APP_DIR)/fittrackee/migrations
|
||||
export DOCKER_FLASK = /usr/local/bin/flask
|
||||
export DOCKER_FTCLI = /usr/local/bin/ftcli
|
||||
export DOCKER_BANDIT = /usr/local/bin/bandit
|
||||
export DOCKER_MYPY = /usr/local/bin/mypy
|
||||
|
||||
# Node env
|
||||
NODE_MODULES = $(PWD)/fittrackee_client/node_modules
|
||||
|
@ -28,7 +28,6 @@ services:
|
||||
- mail
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- ./data/workouts:/usr/src/app/workouts
|
||||
- ./data/uploads:/usr/src/app/uploads
|
||||
networks:
|
||||
- fittrackee-net
|
||||
|
@ -5,4 +5,6 @@ cd /usr/src/app
|
||||
source .env
|
||||
|
||||
mypy fittrackee
|
||||
pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations
|
||||
pytest --isort --black -m "isort or black" fittrackee e2e --ignore=fittrackee/migrations
|
||||
echo 'Running flake8...'
|
||||
flake8 fittrackee e2e
|
Loading…
Reference in New Issue
Block a user