generated from azmisahin/azmisahin-software-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.linux
58 lines (46 loc) · 1.37 KB
/
Dockerfile.linux
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
# base operation system image
FROM ubuntu:latest AS production
# Metadata indicating an image maintainer.
LABEL maintainer="Azmi ŞAHİN <[email protected]>"
# product arguments
ARG ENV="production"
ARG NAME="connector"
# default arguments for build
ARG WORK_DIR="/connector"
ARG BUILD_DIR="build"
ARG DIST_DIR="dist"
# default arguments for application
ARG REMOTE_IP_ADDRESS="198.41.0.4"
ARG REMOTE_PORT="53"
ARG CLIENT_MESSAGE="0"
# product environment
ENV ENV=${ENV}
ENV NAME=${NAME}
# default envionment for build
ENV WORK_DIR=${WORK_DIR}
ENV BUILD_DIR=${BUILD_DIR}
ENV DIST_DIR=${DIST_DIR}
# default environment for application
ENV REMOTE_IP_ADDRESS=${REMOTE_IP_ADDRESS}
ENV REMOTE_PORT=${REMOTE_PORT}
ENV CLIENT_MESSAGE=${CLIENT_MESSAGE}
# make the 'application' folder the current working directory
WORKDIR ${WORK_DIR}
# copy project file the working directory
COPY . .
# install project dependencies
RUN apt-get update
RUN apt-get -y install build-essential
RUN apt-get -y install clang
RUN apt-get -y install cmake
# build
RUN mkdir ${BUILD_DIR} && \
cd ${BUILD_DIR} && \
cmake .. &&\
make &&\
mkdir ${DIST_DIR} && \
mkdir ${DIST_DIR}_test && \
cp ./${NAME} ${DIST_DIR} && \
cp ./${NAME}_test ${DIST_DIR}_test
# test
CMD ["bash", "-c", "${WORK_DIR}/${BUILD_DIR}/${DIST_DIR}_test/${NAME}_test ${REMOTE_IP_ADDRESS} ${REMOTE_PORT} \"${CLIENT_MESSAGE}\""]