From 594b743a3d69bbad14d893394d84c1c56d73bbaa Mon Sep 17 00:00:00 2001 From: Gianni GIUDICE Date: Tue, 12 Jan 2021 15:11:27 +0100 Subject: [PATCH] =?UTF-8?q?:tada:=20Cr=C3=A9ation=20du=20DockerFile=20et?= =?UTF-8?q?=20fichier=20de=20config=20circleci=20initiaux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/config.yml | 16 +++++ Dockerfile | 13 ++++ migrations/versions/944ac21a18d9_.py | 101 +++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 Dockerfile create mode 100644 migrations/versions/944ac21a18d9_.py diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..f057166 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,16 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/python:3.9 + steps: + - checkout + - run: + command: pip install -r requirements/dev.txt + + +workflows: + version: 2 + build-test: + jobs: + -build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..df11664 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.9 + +WORKDIR /app +COPY . . + +ENV CONDUIT_SECRET='something-really-secret' +ENV FLASK_APP=autoapp.py +ENV FLASK_DEBUG=1 + +RUN pip install -r requirements/dev.txt + +EXPOSE 8000 +CMD python autoapp.py diff --git a/migrations/versions/944ac21a18d9_.py b/migrations/versions/944ac21a18d9_.py new file mode 100644 index 0000000..5a9c382 --- /dev/null +++ b/migrations/versions/944ac21a18d9_.py @@ -0,0 +1,101 @@ +"""empty message + +Revision ID: 944ac21a18d9 +Revises: 2267f00a4594 +Create Date: 2021-01-12 14:10:54.153236 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '944ac21a18d9' +down_revision = '2267f00a4594' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('tags', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('tagname', sa.String(length=100), nullable=True), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('users', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('username', sa.String(length=80), nullable=False), + sa.Column('email', sa.String(length=100), nullable=False), + sa.Column('password', sa.Binary(), nullable=True), + sa.Column('created_at', sa.DateTime(), nullable=False), + sa.Column('updated_at', sa.DateTime(), nullable=False), + sa.Column('bio', sa.String(length=300), nullable=True), + sa.Column('image', sa.String(length=120), nullable=True), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('email'), + sa.UniqueConstraint('username') + ) + op.create_table('userprofile', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('user_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('user_id') + ) + op.create_table('article', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('slug', sa.Text(), nullable=True), + sa.Column('title', sa.String(length=100), nullable=False), + sa.Column('description', sa.Text(), nullable=False), + sa.Column('body', sa.Text(), nullable=True), + sa.Column('createdAt', sa.DateTime(), nullable=False), + sa.Column('updatedAt', sa.DateTime(), nullable=False), + sa.Column('author_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['author_id'], ['userprofile.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('slug') + ) + op.create_table('followers_assoc', + sa.Column('follower', sa.Integer(), nullable=True), + sa.Column('followed_by', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['followed_by'], ['userprofile.user_id'], ), + sa.ForeignKeyConstraint(['follower'], ['userprofile.user_id'], ) + ) + op.create_table('comment', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('body', sa.Text(), nullable=True), + sa.Column('createdAt', sa.DateTime(), nullable=False), + sa.Column('updatedAt', sa.DateTime(), nullable=False), + sa.Column('author_id', sa.Integer(), nullable=False), + sa.Column('article_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['article_id'], ['article.id'], ), + sa.ForeignKeyConstraint(['author_id'], ['userprofile.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('favoritor_assoc', + sa.Column('favoriter', sa.Integer(), nullable=True), + sa.Column('favorited_article', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['favorited_article'], ['article.id'], ), + sa.ForeignKeyConstraint(['favoriter'], ['userprofile.id'], ) + ) + op.create_table('tag_assoc', + sa.Column('tag', sa.Integer(), nullable=True), + sa.Column('article', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['article'], ['article.id'], ), + sa.ForeignKeyConstraint(['tag'], ['tags.id'], ) + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('tag_assoc') + op.drop_table('favoritor_assoc') + op.drop_table('comment') + op.drop_table('followers_assoc') + op.drop_table('article') + op.drop_table('userprofile') + op.drop_table('users') + op.drop_table('tags') + # ### end Alembic commands ###