-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 1.19 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
# Use Ubuntu as the base image
FROM ubuntu:20.04
# Copy the files from your project
WORKDIR /app
# Update the package manager
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
tzdata
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
make \
cmake \
wget \
unzip \
vim \
git \
curl \
libopencv-dev \
libboost-all-dev
RUN apt-get install -y build-essential
RUN apt-get update && apt-get -y install cmake protobuf-compiler
RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcpu.zip -O libtorch.zip
RUN unzip -o libtorch.zip
ENV LIBTORCH /app/libtorch
ENV LD_LIBRARY_PATH /app/libtorch/lib:$LD_LIBRARY_PATH
RUN apt-get install -y libcurl4-openssl-dev
# Install the necessary dependencies
COPY ["CMakeLists.txt","image_classification.cpp","label.txt","resnet18.pt","./"]
# Change the working director
# Build the project
RUN mkdir build && cd build && cmake .. -DCMAKE_PREFIX_PATH=$PWD/../libtorch .. && make
WORKDIR /app/build
RUN chmod +x image_classification
CMD ["./image_classification"]