Docker

Docker Illustration

Docker

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Keuntungan Menggunakan Docker

Alasan Kenapa Harus Menggunakan Docker

Contoh implementasi Docker

FROM python:3.10-slim as dev
ENV PYTHONBUFFERED=1

RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential libpq-dev && \
rm -rf /var/lib/apt/lists/*


RUN pip install pipenv
COPY Pipfile /app/

WORKDIR /app

RUN pipenv lock --keep-outdated --requirements > requirements.txt && \
pip install --no-cache-dir -r requirements.txt

COPY ./script .
RUN chmod +x *.sh

FROM python:3.10-slim as prod
ENV PYTHONBUFFERED=1

RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential libpq-dev && \
rm -rf /var/lib/apt/lists/*


RUN pip install pipenv
COPY Pipfile /app/

WORKDIR /app

RUN pipenv lock --keep-outdated --requirements > requirements.txt && \
pip install --no-cache-dir -r requirements.txt

EXPOSE 8000
COPY ./script .
RUN chmod +x *.sh
COPY ./evisem_backend .

ENTRYPOINT ["./entrypoint.sh"]
CMD ["./start.sh", "server"]

Referensi

--

--

Not a Writer :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store