Add event processing container
|
@ -1,7 +1,7 @@
|
|||
FROM python:3.9-slim
|
||||
|
||||
WORKDIR /app
|
||||
COPY src /app
|
||||
COPY api /app
|
||||
|
||||
# install any needed packages specified in requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
@ -5,15 +5,29 @@ networks:
|
|||
|
||||
services:
|
||||
|
||||
3lips:
|
||||
api:
|
||||
restart: always
|
||||
build: .
|
||||
image: 3lips
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./api/Dockerfile
|
||||
image: 3lips-api
|
||||
ports:
|
||||
- 49156:5000
|
||||
networks:
|
||||
- 3lips
|
||||
container_name: 3lips
|
||||
container_name: 3lips-api
|
||||
|
||||
event:
|
||||
restart: always
|
||||
build:
|
||||
context: ./event
|
||||
dockerfile: Dockerfile
|
||||
image: 3lips-event
|
||||
networks:
|
||||
- 3lips
|
||||
volumes:
|
||||
- ./db:/app/db
|
||||
container_name: 3lips-event
|
||||
|
||||
cesium-apache:
|
||||
restart: always
|
||||
|
@ -23,5 +37,6 @@ services:
|
|||
image: cesium-apache
|
||||
networks:
|
||||
- 3lips
|
||||
container_name: 3lips-cesium
|
||||
|
||||
volumes:
|
||||
- ./db:/app/db
|
||||
container_name: 3lips-cesium
|
14
event/Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Use an official Python runtime as a parent image
|
||||
FROM python:3.9-slim
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY . /app
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Run the command when the container launches
|
||||
CMD ["python", "./event.py"]
|
18
event/event.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import asyncio
|
||||
from datetime import datetime
|
||||
|
||||
print('testtttttt', flush=True)
|
||||
|
||||
async def event():
|
||||
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
print("Event triggered at: " + timestamp, flush=True)
|
||||
|
||||
# Create and run the event loop
|
||||
async def main():
|
||||
# Run the event loop
|
||||
while True:
|
||||
await event()
|
||||
await asyncio.sleep(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
1
event/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
numpy==1.26.4
|