Dockerfile 1.75 KB
Newer Older
1
FROM node:8.12-stretch
2 3
LABEL maintainer="horstmannmat <mch15@inf.ufpr.br>"

Matheus Horstmann's avatar
Matheus Horstmann committed
4
# Set an environment variable to prevent debian warning.
5 6 7 8
ENV DEBIAN_FRONTEND noninteractive
ENV LANG C.UTF-8

# Set an environment variable to store where the app is installed to inside of the Docker image.
Matheus Horstmann's avatar
Matheus Horstmann committed
9 10
ENV WORKSPACE /app
RUN mkdir -p $WORKSPACE
11

Matheus Horstmann's avatar
Matheus Horstmann committed
12
# Install apt-utils to prevent warning messages
Matheus Horstmann's avatar
Matheus Horstmann committed
13
RUN apt-get -qq update -y && apt-get -qq install -y apt-utils git
Matheus Horstmann's avatar
Matheus Horstmann committed
14
# Install necessary libs to compile and run ensalador
Matheus Horstmann's avatar
Matheus Horstmann committed
15
RUN apt-get -qq install -y cmake libstdc++6 libyaml-cpp-dev libboost-all-dev --no-install-recommends
16

Matheus Horstmann's avatar
Matheus Horstmann committed
17
RUN git clone --quiet https://github.com/saebyn/munkres-cpp.git /tmp/munkres-cpp && cd /tmp/munkres-cpp && mkdir build && cd build && cmake .. && make && make install && cd /  && rm -rf /tmp/munkres-cpp
18

Matheus Horstmann's avatar
Matheus Horstmann committed
19 20
# Change WORKSPACE owner
RUN  chown -R node:node $WORKSPACE
21

Matheus Horstmann's avatar
Matheus Horstmann committed
22 23 24 25 26 27
# Change running user
USER node
# This sets the context of where commands will be ran in and is documented
# on Docker's website extensively.
# Set app directory
WORKDIR $WORKSPACE
28

Matheus Horstmann's avatar
Matheus Horstmann committed
29 30 31 32 33
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY --chown=node:node package.json .
COPY --chown=node:node yarn.lock .
34

Matheus Horstmann's avatar
Matheus Horstmann committed
35 36 37
# If you are building your code for production
# RUN yarn install --production --frozen-lockfile --silent --non-interactive
RUN  yarn install --frozen-lockfile --silent --non-interactive
38

bhmeyer's avatar
bhmeyer committed
39 40 41 42
## Compile ensalor here
RUN mkdir /app/bin/ &&  mkdir /app/bin/ensalador
COPY --chown=node:node bin/ensalador /app/bin/ensalador
RUN cd /app/bin/ensalador && cmake . && make && cd /app
43 44


Matheus Horstmann's avatar
Matheus Horstmann committed
45 46
# Bundle app source
COPY --chown=node:node . .
47

bhmeyer's avatar
bhmeyer committed
48 49 50

ENV PATH=$PATH:/app/node_modules/.bin
EXPOSE 3000
51 52 53 54

ENTRYPOINT ["/app/ensalamento-entrypoint.sh"]

CMD ["DEVELOPMENT"]