Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
pytorch/Dockerfile at master · ezyang/pytorch · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ezyang
pytorch
Repository navigation
Code
Pull requests
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
pytorch
/
Dockerfile
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
81 lines (74 loc) · 2.86 KB
master
Breadcrumbs
pytorch
/
Dockerfile
Copy path
Top
File metadata and controls
Code
Blame
81 lines (74 loc) · 2.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#
syntax = docker/dockerfile:experimental
#
#
NOTE: To build this you will need a docker version > 18.06 with
#
experimental enabled and DOCKER_BUILDKIT=1
#
#
If you do not use buildkit you are not going to have a good time
#
#
For reference:
#
https://docs.docker.com/develop/develop-images/build_enhancements/
ARG
BASE_IMAGE=ubuntu:18.04
ARG
PYTHON_VERSION=3.8
FROM
${BASE_IMAGE} as dev-base
RUN
--mount=type=cache,id=apt-dev,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
ccache \
cmake \
curl \
git \
libjpeg-dev \
libpng-dev && \
rm -rf /var/lib/apt/lists/*
RUN
/usr/sbin/update-ccache-symlinks
RUN
mkdir /opt/ccache && ccache --set-config=cache_dir=/opt/ccache
ENV
PATH /opt/conda/bin:$PATH
FROM
dev-base as conda
ARG
PYTHON_VERSION=3.8
RUN
curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython && \
/opt/conda/bin/conda clean -ya
FROM
dev-base as submodule-update
WORKDIR
/opt/pytorch
COPY
. .
RUN
git submodule update --init --recursive --jobs 0
FROM
conda as build
WORKDIR
/opt/pytorch
COPY
--from=conda /opt/conda /opt/conda
COPY
--from=submodule-update /opt/pytorch /opt/pytorch
RUN
--mount=type=cache,target=/opt/ccache \
TORCH_CUDA_ARCH_LIST=
"3.5 5.2 6.0 6.1 7.0+PTX 8.0"
TORCH_NVCC_FLAGS=
"-Xfatbin -compress-all"
\
CMAKE_PREFIX_PATH=
"$(dirname $(which conda))/../"
\
python setup.py install
FROM
conda as conda-installs
ARG
PYTHON_VERSION=3.8
ARG
CUDA_VERSION=11.3
ARG
CUDA_CHANNEL=nvidia
ARG
INSTALL_CHANNEL=pytorch-nightly
ENV
CONDA_OVERRIDE_CUDA=${CUDA_VERSION}
RUN
/opt/conda/bin/conda install -c
"${INSTALL_CHANNEL}"
-c
"${CUDA_CHANNEL}"
-y python=${PYTHON_VERSION} pytorch torchvision torchtext
"cudatoolkit=${CUDA_VERSION}"
&& \
/opt/conda/bin/conda clean -ya
RUN
/opt/conda/bin/pip install torchelastic
FROM
${BASE_IMAGE} as official
ARG
PYTORCH_VERSION
LABEL
com.nvidia.volumes.needed=
"nvidia_driver"
RUN
--mount=type=cache,id=apt-final,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libjpeg-dev \
libpng-dev && \
rm -rf /var/lib/apt/lists/*
COPY
--from=conda-installs /opt/conda /opt/conda
ENV
PATH /opt/conda/bin:$PATH
ENV
NVIDIA_VISIBLE_DEVICES all
ENV
NVIDIA_DRIVER_CAPABILITIES compute,utility
ENV
LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64
ENV
PYTORCH_VERSION ${PYTORCH_VERSION}
WORKDIR
/workspace
FROM
official as dev
#
Should override the already installed version from the official-image stage
COPY
--from=build /opt/conda /opt/conda
You can’t perform that action at this time.