Skip to content

Instantly share code, notes, and snippets.

@theeluwin
Last active November 12, 2019 04:33
Show Gist options
  • Save theeluwin/331f6304d11d1b2e1748b7c457290955 to your computer and use it in GitHub Desktop.
Save theeluwin/331f6304d11d1b2e1748b7c457290955 to your computer and use it in GitHub Desktop.
파이토치 런타임 환경용 도커
# syntax=docker/dockerfile:experimental
# from
FROM pytorch/pytorch:1.2-cuda10.0-cudnn7-runtime
LABEL maintainer="Jamie Seol <[email protected]>"
# apt init
ENV PYTHONUNBUFFERED=1
ENV LANG=C.UTF-8
ENV TZ=Asia/Seoul
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends tzdata
# apt cleanse
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
# timezone
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# settle workspace
RUN mkdir -p /workspace
WORKDIR /workspace
# install python packages
COPY requirements.txt /workspace/
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
# torch cache
RUN mkdir -p /root/.cache/torch/checkpoints/
@theeluwin
Copy link
Author

theeluwin commented Nov 4, 2019

DOCKER_BUILDKIT=1 docker build -t jamie-sandbox -f Dockerfile .
docker run --rm -it --init --gpus=all --volume="$HOME/.cache/torch:/root/.cache/torch" --volume="$PWD:/workspace" -e NVIDIA_VISIBLE_DEVICES=1 jamie-sandbox python entry.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment