-
Notifications
You must be signed in to change notification settings - Fork 201
/
Dockerfile
82 lines (56 loc) · 1.58 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM centos:7 as base
# -----------------
# BUILD
# -----------------
FROM base as build
WORKDIR /src
RUN yum -y install \
epel-release \
gcc \
python-devel
RUN yum -y install \
python-pip \
python36 \
python36-devel \
python36-pip
COPY LICENSE ./
COPY requirements.txt ./
RUN pip install -r requirements.txt
RUN pip3.6 install -r requirements.txt
COPY VERSION.in VERSIO[N] ./
RUN test -e VERSION || echo "$(cat VERSION.in)-custom" | tee VERSION
COPY proto/ ./proto
COPY pycue/README.md ./pycue/
COPY pycue/setup.py ./pycue/
COPY pycue/opencue ./pycue/opencue
COPY pycue/FileSequence ./pycue/FileSequence
RUN python -m grpc_tools.protoc \
-I=./proto \
--python_out=./pycue/opencue/compiled_proto \
--grpc_python_out=./pycue/opencue/compiled_proto \
./proto/*.proto
# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
# TODO(bcipriano) Lint the code here. (Issue #78)
# -----------------
# TEST
# -----------------
FROM build as test
COPY pycue/tests/ ./pycue/tests
RUN cd pycue && python setup.py test
RUN cd pycue && python3.6 setup.py test
# -----------------
# PACKAGE
# -----------------
FROM build as package
RUN cp LICENSE requirements.txt VERSION pycue/
RUN versioned_name="pycue-$(cat ./VERSION)-all" \
&& mv pycue $versioned_name \
&& tar -cvzf $versioned_name.tar.gz $versioned_name/*
# -----------------
# RUN
# -----------------
FROM base
WORKDIR /opt/opencue
COPY --from=package /src/pycue-*-all.tar.gz ./