Skip to content

Instantly share code, notes, and snippets.

@octavifs
Created May 7, 2021 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save octavifs/2f95253a274403641d2b2586845adf23 to your computer and use it in GitHub Desktop.
Save octavifs/2f95253a274403641d2b2586845adf23 to your computer and use it in GitHub Desktop.
Deep Learning in Production Part 1: Reproducible Environments
version: '2.3'
services:
example:
build:
context: .
dockerfile: Dockerfile
command: python -c 'import torch; print(f"{torch.cuda.is_available()=}")'
FROM ubuntu:20.04
ENV LANG=C.UTF-8 DEBIAN_FRONTEND=noninteractive
ENV PATH /opt/conda/bin:$PATH
# Install conda
RUN apt-get update --fix-missing && \
apt-get install --no-install-recommends -y curl ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \
&& bash miniconda.sh -b -p /opt/conda\
&& rm miniconda.sh \
&& conda init \
&& conda update -n base -c defaults conda \
&& conda clean -y --all
# Setup project folder and copy environment.yml
WORKDIR /app
COPY ./environment.yml ./
# Install conda dependencies in default environment
RUN conda env update -n=base -f=environment.yml && conda clean -y --all
# Copy project to /app folder
COPY . ./
name: new-dl-project
channels:
- defaults
- pytorch
dependencies:
- python=3.8
- torchaudio=0.8.1
- pytorch=1.8.1
- cudatoolkit=10.2
- torchvision=0.9.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment