-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (36 loc) · 1.26 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.12-alpine AS builder
LABEL authors="leedg17"
RUN sed 's/https/http/g' -i /etc/apk/repositories
RUN apk update && apk --no-cache add binutils upx
# 1-1) alpine 계정 세팅
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY train/requirements.txt /
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r /requirements.txt
#RUN pip install --no-cache-dir httpx
USER appuser
WORKDIR /home/appuser
COPY --chown=appuser test/ test/
COPY --chown=appuser train/app/ train/app/
COPY --chown=appuser train/application.spec ./application.spec
EXPOSE 9084
ENV PYTHONPATH="/home/appuser"
#RUN pytest test/controller
RUN pyinstaller application.spec
#CMD ["--port", "9084"]
#ENTRYPOINT ["python", "-m", "uvicorn", "train.app.application:app", "--host", "0.0.0.0"]
FROM alpine:3.20
#RUN sed 's/https/http/g' -i /etc/apk/repositories
#RUN apk update && apk --no-cache add htop
# 1-1) alpine 계정 세팅
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
# 2) Native 실행 파일 복사
COPY --from=builder /home/appuser/dist/ /home/appuser/
COPY --chown=appuser train/.env.local /home/appuser/train/.env.local
# 3) 변수 설정
EXPOSE 9084
# 4) 실행
WORKDIR /home/appuser
CMD ["--port", "9084"]
ENTRYPOINT ["./main/application"]