Sign inSign up

nguyentranleminh/fastapi

By nguyentranleminh

•Updated about 2 years ago

Image
0

934

nguyentranleminh/fastapi repository overview

⁠Chọn base image

FROM python:3.9-slim

⁠Install dependencies & JAVA

RUN apt-get update -yqq && \

apt-get upgrade -yqq && \

apt-get install -yqq --no-install-recommends \

apt-utils \

curl \

wget \

netcat-traditional \

&& apt-get autoremove -yqq --purge

RUN apt-get install -yqq --no-install-recommends \

openjdk-17-jre-headless \

&& apt-get autoremove -yqq --purge

RUN pip install confluent-kafka

⁠Setup JAVA

ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/

ENV PATH=${JAVA_HOME}/bin/:$PATH

⁠Tạo thư mục /app trong container

RUN mkdir /app

⁠Đặt thư mục /app làm thư mục làm việc

WORKDIR /app

⁠Cài đặt dependencies

RUN pip install fastapi uvicorn pydantic requests

⁠Sao chép mã nguồn từ thư mục hiện tại vào thư mục /app trong container

COPY ./app /app

⁠Expose cổng mà FastAPI sử dụng

EXPOSE 8000

⁠Command để chạy FastAPI

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

Tag summary

Content type

Image

Digest

sha256:8bf633f75…

Size

77 MB

Last updated

about 2 years ago

docker pull nguyentranleminh/fastapi