mirror of
https://github.com/hwanny1128/HGZero.git
synced 2025-12-06 06:46:24 +00:00
for merge
This commit is contained in:
parent
66101b2465
commit
503078bf3f
53
deployment/container/Dockerfile-ai-python
Normal file
53
deployment/container/Dockerfile-ai-python
Normal file
@ -0,0 +1,53 @@
|
||||
# Build stage
|
||||
FROM python:3.13-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
g++ \
|
||||
make \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements and install to /opt/venv
|
||||
COPY requirements.txt .
|
||||
RUN python -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Run stage
|
||||
FROM python:3.13-slim
|
||||
|
||||
ENV USERNAME=k8s
|
||||
ENV ARTIFACTORY_HOME=/home/${USERNAME}
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# Add a non-root user
|
||||
RUN adduser --system --group ${USERNAME} && \
|
||||
mkdir -p ${ARTIFACTORY_HOME} && \
|
||||
chown ${USERNAME}:${USERNAME} ${ARTIFACTORY_HOME}
|
||||
|
||||
WORKDIR ${ARTIFACTORY_HOME}
|
||||
|
||||
# Copy Python virtual environment from builder
|
||||
COPY --from=builder /opt/venv /opt/venv
|
||||
|
||||
# Copy application code
|
||||
COPY --chown=${USERNAME}:${USERNAME} . .
|
||||
|
||||
# Update PATH to include venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
USER ${USERNAME}
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8087
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD python -c "import requests; requests.get('http://localhost:8087/health')" || exit 1
|
||||
|
||||
# Run the application
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8087"]
|
||||
@ -1,5 +1,5 @@
|
||||
# Build stage
|
||||
FROM python:3.11-slim AS builder
|
||||
FROM python:3.13-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@ -18,7 +18,7 @@ ENV PATH="/opt/venv/bin:$PATH"
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Run stage
|
||||
FROM python:3.11-slim
|
||||
FROM python:3.13-slim
|
||||
|
||||
ENV USERNAME=k8s
|
||||
ENV ARTIFACTORY_HOME=/home/${USERNAME}
|
||||
|
||||
@ -25,6 +25,7 @@ public class TranscriptionEvent {
|
||||
private String segmentId;
|
||||
private String recordingId;
|
||||
private String meetingId;
|
||||
private String sessionId; // SSE 연결을 위한 세션 ID
|
||||
private String text;
|
||||
private String speakerId;
|
||||
private String speakerName;
|
||||
@ -34,7 +35,7 @@ public class TranscriptionEvent {
|
||||
private Boolean warningFlag;
|
||||
private LocalDateTime eventTime;
|
||||
|
||||
public static SegmentCreated of(String segmentId, String recordingId, String meetingId,
|
||||
public static SegmentCreated of(String segmentId, String recordingId, String meetingId, String sessionId,
|
||||
String text, String speakerId, String speakerName,
|
||||
LocalDateTime timestamp, Double duration, Double confidence, Boolean warningFlag) {
|
||||
return SegmentCreated.builder()
|
||||
@ -43,6 +44,7 @@ public class TranscriptionEvent {
|
||||
.segmentId(segmentId)
|
||||
.recordingId(recordingId)
|
||||
.meetingId(meetingId)
|
||||
.sessionId(sessionId)
|
||||
.text(text)
|
||||
.speakerId(speakerId)
|
||||
.speakerName(speakerName)
|
||||
|
||||
@ -84,7 +84,7 @@ public class TranscriptionServiceImpl implements TranscriptionService {
|
||||
ZoneId.systemDefault()
|
||||
);
|
||||
TranscriptionEvent.SegmentCreated event = TranscriptionEvent.SegmentCreated.of(
|
||||
segmentId, request.getRecordingId(), recording.getMeetingId(),
|
||||
segmentId, request.getRecordingId(), recording.getMeetingId(), recording.getSessionId(),
|
||||
recognizedText, speakerId, "화자-" + speakerId.substring(4),
|
||||
timestampAsDateTime, 3.5, confidence, warningFlag
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user