도커파일 최적화

hyuckhoon.ko·2022년 12월 6일
0

FROM python:3.9.6-buster

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN apt-get update && apt-get install -y --no-install-recommends \
    vim \
    apt-utils \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /web/
WORKDIR /web/
COPY web deploy/entrypoint.sh requirements.txt ./
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

EXPOSE 8000

RUN adduser --disabled-password --gecos '' user
RUN chown -R user:user /web
RUN chmod -R 755 /web
USER user

CMD ./entrypoint.sh

FROM python:3.9.6-buster

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN mkdir -p /web/ && adduser --no-create-home --disabled-password --gecos '' user  \
    && chown -R user:user /web
WORKDIR /web/
COPY --chmod=755 --chown=user:user web deploy/entrypoint.sh requirements.txt ./
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt \
    && rm -rf requirements.txt

USER user
EXPOSE 8000
CMD ./entrypoint.sh

0개의 댓글