-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworking a bit to be able to do everything using docker
- Loading branch information
Showing
12 changed files
with
496 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
FROM python:3.9 | ||
|
||
RUN mkdir /app | ||
COPY . /app | ||
WORKDIR /app | ||
ENV PYTHONPATH=${PYTHONPATH}:${PWD} | ||
|
||
RUN pip3 install poetry | ||
COPY ./pyproject.toml . | ||
COPY ./poetry.lock . | ||
RUN poetry config virtualenvs.create false | ||
RUN poetry install | ||
|
||
COPY ./ . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
.PHONY: all install update uninstall | ||
.PHONY: start stop clean run_migrations create_migration run_tests | ||
|
||
all: | ||
@docker compose run --rm --entrypoint '' api flask db upgrade | ||
start: | ||
@docker compose up --build --detach --remove-orphans | ||
|
||
install: | ||
@docker compose up --detach --remove-orphans | ||
stop: | ||
@docker compose stop | ||
|
||
update: | ||
@docker compose pull | ||
@docker compose up --force-recreate --build --detach | ||
watch: | ||
@docker compose logs --tail 100 --follow | ||
|
||
uninstall: | ||
clean: | ||
@docker compose stop | ||
@docker compose rm --volumes --force | ||
|
||
run_migrations: | ||
@docker compose run -d database | ||
@docker compose run --rm --entrypoint '' api flask db upgrade | ||
|
||
create_migration: run_migrations | ||
@docker compose run --rm --entrypoint '' api flask db migrate -m "Reword me" | ||
|
||
run_tests: | ||
@docker compose run -d database | ||
@docker compose run -e DATABASE_NAME=lightsoff_test --rm --entrypoint '' api pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CREATE DATABASE lightsoff_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.