forked from score-partners/Internet-of-Things-Registry
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
60 lines (45 loc) · 1.26 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
FROM node:8.15-stretch AS builder
LABEL maintainer="[email protected]"
ARG BUILD_ENV=prod
ARG BUILD_NUMBER=0
WORKDIR /app
# Run updates and cleanup
RUN apt-get update
RUN apt-get install -y \
netcat \
git
RUN rm -rf /var/lib/apt/lists/*
# Copy sources
# COPY . /app/
COPY src /app/src
COPY public /app/public
COPY internals /app/internals
COPY server /app/server
# COPY test /app/test
COPY package.json \
package-lock.json \
.gitignore \
.gitattributes \
/app/
COPY environment.conf.${BUILD_ENV}.json /app/environment.conf.json
# Changing git URL because network is blocking git protocol...
RUN git config --global url."https://".insteadOf git://
RUN git config --global url."https://github.com/".insteadOf [email protected]:
# Install NPM dependencies. Also:
RUN npm --production=false \
--unsafe-perm \
--verbose \
install
RUN npm cache clean --force
# Build
RUN echo "run build"
# RUN npm rebuild node-sass
RUN npm run build
# Test
# Deploy
FROM nginx:stable-alpine
COPY --from=builder /app/build/. /usr/share/nginx/html/
COPY default.conf /etc/nginx/conf.d/
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log