update repository references and improve script handling
This commit is contained in:
70
blank-fastapi-vue-hassio/Dockerfile
Executable file → Normal file
70
blank-fastapi-vue-hassio/Dockerfile
Executable file → Normal file
@@ -1,49 +1,25 @@
|
||||
ARG BUILD_FROM=hassioaddons/base-python:5.2.0
|
||||
# hadolint ignore=DL3006
|
||||
FROM ${BUILD_FROM}
|
||||
FROM python:3.11-buster
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libssl-dev \
|
||||
libffi-dev \
|
||||
python3-dev \
|
||||
libpq-dev \
|
||||
libjpeg-dev \
|
||||
libwebp-dev \
|
||||
libtiff5-dev \
|
||||
zlib1g-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libldap2-dev \
|
||||
libsasl2-dev \
|
||||
libmysqlclient-dev \
|
||||
default-libmysqlclient-dev && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy Python requirements file
|
||||
COPY hello_flask/requirements.txt /tmp/
|
||||
COPY hello_flask/app.py /
|
||||
|
||||
# Setup base
|
||||
ARG BUILD_ARCH=amd64
|
||||
RUN \
|
||||
apk add --no-cache --virtual .build-dependencies \
|
||||
g++=9.2.0-r4 \
|
||||
gcc=9.2.0-r4 \
|
||||
make=4.2.1-r2 \
|
||||
\
|
||||
&& apk add --no-cache \
|
||||
nginx-mod-http-lua=1.16.1-r6 \
|
||||
lua-resty-http=0.15-r0 \
|
||||
nginx=1.16.1-r6 \
|
||||
cython=0.29.14-r0 \
|
||||
\
|
||||
&& pip3 install \
|
||||
--no-cache-dir \
|
||||
--prefer-binary \
|
||||
--find-links "https://wheels.hass.io/alpine-3.11/${BUILD_ARCH}/" \
|
||||
-r /tmp/requirements.txt \
|
||||
\
|
||||
&& find /usr/local \
|
||||
\( -type d -a -name test -o -name tests -o -name '__pycache__' \) \
|
||||
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
|
||||
-exec rm -rf '{}' + \
|
||||
\
|
||||
&& apk del --purge .build-dependencies \
|
||||
&& rm -f -r \
|
||||
/etc/nginx \
|
||||
/tmp/*
|
||||
|
||||
# Copy data for add-on
|
||||
COPY run.sh /
|
||||
COPY hello_flask/requirements.txt /tmp/
|
||||
# Install requirements for add-on
|
||||
RUN pip install -r /tmp/requirements.txt
|
||||
|
||||
RUN chmod a+x /run.sh
|
||||
CMD [ "/run.sh" ]
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install --upgrade setuptools
|
||||
RUN pip install --upgrade wheel
|
||||
RUN pip install uv
|
||||
@@ -28,3 +28,6 @@ run:
|
||||
@echo "Running server..."
|
||||
uvicorn app.main:app --host localhost --port 8000
|
||||
@echo "Server running at http://localhost:8000"
|
||||
|
||||
|
||||
|
||||
|
||||
49
blank-fastapi-vue-hassio/_Dockerfile
Executable file
49
blank-fastapi-vue-hassio/_Dockerfile
Executable file
@@ -0,0 +1,49 @@
|
||||
#ARG BUILD_FROM=hassioaddons/base-python:5.2.0
|
||||
# hadolint ignore=DL3006
|
||||
FROM hassioaddons/base-python:5.2.0
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Copy Python requirements file
|
||||
COPY requirements.txt /tmp/
|
||||
COPY src /app
|
||||
|
||||
# Setup base
|
||||
ARG BUILD_ARCH=amd64
|
||||
RUN \
|
||||
apk add --no-cache --virtual .build-dependencies \
|
||||
g++ \
|
||||
gcc \
|
||||
make \
|
||||
\
|
||||
&& apk add --no-cache \
|
||||
nginx-mod-http-lua=1.16.1-r6 \
|
||||
lua-resty-http=0.15-r0 \
|
||||
nginx=1.16.1-r6 \
|
||||
cython=0.29.14-r0 \
|
||||
\
|
||||
&& pip3 install \
|
||||
--no-cache-dir \
|
||||
--prefer-binary \
|
||||
--find-links "https://wheels.hass.io/alpine-3.11/${BUILD_ARCH}/" \
|
||||
-r /tmp/requirements.txt \
|
||||
\
|
||||
&& find /usr/local \
|
||||
\( -type d -a -name test -o -name tests -o -name '__pycache__' \) \
|
||||
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
|
||||
-exec rm -rf '{}' + \
|
||||
\
|
||||
&& apk del --purge .build-dependencies \
|
||||
&& rm -f -r \
|
||||
/etc/nginx \
|
||||
/tmp/*
|
||||
|
||||
# Copy data for add-on
|
||||
COPY run.sh /
|
||||
COPY requirements.txt /tmp/
|
||||
# Install requirements for add-on
|
||||
RUN pip install -r /tmp/requirements.txt
|
||||
|
||||
RUN chmod a+x /run.sh
|
||||
CMD [ "/run.sh" ]
|
||||
@@ -1,147 +1,16 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:13-alpine
|
||||
container_name: social_db
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
volumes:
|
||||
- ./docker/data/db/data:/var/lib/postgresql/data
|
||||
- ./docker/data/db/backup:/backup
|
||||
- ./etc/init-user.sql:/docker-entrypoint-initdb.d/init-user.sql
|
||||
ports:
|
||||
- "8432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
DEV: "true"
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8000:8000"
|
||||
restart: always
|
||||
container_name: social_app
|
||||
env_file:
|
||||
- .env
|
||||
links:
|
||||
- db
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
command: sh -c "aerich upgrade && uvicorn main:app --reload --host 0.0.0.0 --port 8080"
|
||||
volumes:
|
||||
- ./src:/src/
|
||||
command: sh -c "uvicorn main:app --reload --host 0.0.0.0 --port 8000"
|
||||
|
||||
rabbitmq:
|
||||
container_name: social_rabbitmq
|
||||
image: rabbitmq:3-management-alpine
|
||||
ports:
|
||||
- "3672:5672"
|
||||
- "14672:15672"
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmqctl", "status"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
taskiq-worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: social_taskiq
|
||||
container_name: social_taskiq
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- ./src:/src
|
||||
links:
|
||||
- db
|
||||
- rabbitmq
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
command: [ taskiq, worker, core.tkq:broker, -fsd]
|
||||
ports: []
|
||||
|
||||
taskiq-faststream-scheduler:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: social_taskiq_faststream_scheduler
|
||||
container_name: social_taskiq_faststream_scheduler
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- ./src:/src
|
||||
links:
|
||||
- db
|
||||
- rabbitmq
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
command: [ taskiq, scheduler, core.tkq_faststream:scheduler, -fsd]
|
||||
ports: []
|
||||
|
||||
taskiq-scheduler:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: social_taskiq_scheduler
|
||||
container_name: social_taskiq_scheduler
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- ./src:/src
|
||||
links:
|
||||
- db
|
||||
- rabbitmq
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
command: [ taskiq, scheduler, core.tkq:scheduler, -fsd]
|
||||
ports: []
|
||||
|
||||
redis:
|
||||
image: redis:6.0-alpine
|
||||
container_name: social_redis
|
||||
restart: always
|
||||
volumes:
|
||||
- ./docker/data/redis:/data
|
||||
ports:
|
||||
- 6377:6379
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
faststream_worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
env_file: .env
|
||||
links:
|
||||
- db
|
||||
- redis
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_started
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
command: python core/faststream_worker.py
|
||||
|
||||
@@ -21,6 +21,7 @@ pre-commit==4.1.0
|
||||
pydantic==2.10.6
|
||||
pydantic-core==2.27.2
|
||||
pytest==8.3.5
|
||||
pytest-asyncio==0.25.3
|
||||
pytest-cov==6.0.0
|
||||
pytest-mock==3.14.0
|
||||
pyyaml==6.0.2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
echo Running flask hello world
|
||||
uvicorn app.main:app --host localhost --port 8000
|
||||
uvicorn main:app --host localhost --port 8000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user