diff --git a/Dockerfile b/Dockerfile index bdb0468..80b98d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,8 @@ -FROM registry.access.redhat.com/ubi8/ubi-minimal:latest +FROM python:3.11-alpine EXPOSE 8080 -RUN microdnf update -y && \ - microdnf install -y \ - curl \ - lsof \ - python3 \ - python3-pip \ - python3-setuptools \ - python3-wheel \ - tzdata +ENV TZ="UTC" +RUN apk add curl tzdata && \ + pip install -U pip # Install dependencies: COPY requirements.txt . @@ -21,4 +15,4 @@ COPY config.py.in /paddles/config.py COPY alembic.ini.in /paddles/alembic.ini COPY container_start.sh /paddles/container_start.sh WORKDIR /paddles -CMD bash container_start.sh +CMD sh container_start.sh diff --git a/alembic/versions/266e6f3efd94_index_run_name.py b/alembic/versions/266e6f3efd94_index_run_name.py new file mode 100644 index 0000000..6eb482e --- /dev/null +++ b/alembic/versions/266e6f3efd94_index_run_name.py @@ -0,0 +1,21 @@ +"""Index Run.name + +Revision ID: 266e6f3efd94 +Revises: 11e2594da07b +Create Date: 2023-07-31 12:01:24.936988 + +""" + +# revision identifiers, used by Alembic. +revision = '266e6f3efd94' +down_revision = '11e2594da07b' + +from alembic import op + + +def upgrade(): + op.create_index('ix_runs_name', 'runs', ['name'], unique=True) + + +def downgrade(): + op.drop_index('ix_runs_name', table_name='runs') diff --git a/container_start.sh b/container_start.sh index e201487..55c8843 100644 --- a/container_start.sh +++ b/container_start.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -ex trap exit TERM pecan populate config.py diff --git a/paddles/models/runs.py b/paddles/models/runs.py index d90514a..0e2a620 100644 --- a/paddles/models/runs.py +++ b/paddles/models/runs.py @@ -102,7 +102,7 @@ class Run(Base): __tablename__ = 'runs' id = Column(Integer, primary_key=True) - name = Column(String(512), unique=True) + name = Column(String(512), index=True, unique=True) status = Column(String(16), index=True) user = Column(String(32), index=True) scheduled = Column(DateTime, index=True)