-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
59 lines (45 loc) · 2.13 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
53
54
55
56
57
58
59
FROM ubuntu:latest
# set apt to noninteractive mode (for installing tzdata)
ENV DEBIAN_FRONTEND='noninteractive'
RUN apt-get update && \
apt-get install -y software-properties-common \
vim \
git \
build-essential \
wget \
curl \
zsh \
tzdata
# add deadsnake repo for install python3.10
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get update && \
apt-get install -y python3-dev \
python3-pip \
virtualenv \
python3.8 \
python3.9 \
python3.10
# install oh-my-zsh
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
RUN echo "Europe/Berlin" > /etc/timezone && \
ln -fs /usr/share/zoneinfo/`cat /etc/timezone` /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
RUN echo "alias python=python3" >> ~/.zshrc
RUN echo "alias pip=pip3" >> ~/.zshrc
# install rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
ENV VIRTUAL_ENV_PATH="/tmp/venv"
# first copy only requirements files to only invalidate the next setps in case of changed requirements
COPY requirements.txt /tmp/requirements.txt
COPY entrypoint.sh /entrypoint.d/entrypoint.sh
# install pip dependencies
RUN virtualenv -p python3.8 $VIRTUAL_ENV_PATH
RUN /bin/bash -c 'source $VIRTUAL_ENV_PATH/bin/activate && pip install -r /tmp/requirements.txt'
# add convenience aliases
RUN echo "alias cargotest='cargo test --no-default-features'" >> /etc/zsh/zshrc
RUN echo "alias maturinbuild-pipinstall='maturin build -i python3.8 --skip-auditwheel && pip install --force pip install target/wheels/sportgems-*_x86_64.whl'" >> /etc/zsh/zshrc
RUN echo "alias maturinpytest='maturin build -i python3.8 --skip-auditwheel && pip install --force pip install target/wheels/sportgems-*_x86_64.whl && pytest tests/ -v'" >> /etc/zsh/zshrc
COPY . /sportgems
WORKDIR /workspaces/sportgems
ENTRYPOINT [ "/entrypoint.d/entrypoint.sh" ]