forked from apple/axlearn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (40 loc) · 1.77 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1
ARG TARGET=base
FROM python:3.8-slim AS base
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates gnupg curl gcc g++
# Install git.
RUN apt-get install -y git
# Install gcloud. https://cloud.google.com/sdk/docs/install
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt-get update -y && apt-get install google-cloud-cli -y
# Install screen and other utils for launch script.
RUN apt-get install -y jq screen ca-certificates
# Setup.
RUN mkdir -p /root
WORKDIR /root
# Introduce the minimum set of files for install.
COPY README.md README.md
COPY pyproject.toml pyproject.toml
RUN mkdir axlearn && touch axlearn/__init__.py
# Setup venv to suppress pip warnings.
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies.
RUN pip install flit
RUN pip install --upgrade pip
################################################################################
# CI container spec. #
################################################################################
# Leverage multi-stage build for unit tests.
FROM base as ci
RUN pip install .[dev]
COPY . .
# `exit 1` fails the build.
RUN ./run_tests.sh
################################################################################
# Final target spec. #
################################################################################
FROM ${TARGET} AS final