forked from algorithmiaio/dev-center
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
83 lines (57 loc) · 1.6 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
82
83
#
# Stage 1: build Synapse dist/ files
#
FROM node:10.14 as style-builder
WORKDIR /app
COPY ./synapse .
# Install dependencies
RUN npm ci
# Build files
RUN npm run build
#
# Stage 2: build API docs
#
FROM ruby:2.3 AS docs-builder
RUN apt-get update && apt-get install -y nodejs \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /opt/builds
COPY ./api-docs .
RUN gem install bundler && gem update --system
# Install dependencies
RUN bundle install
# Autoprefixer gem requires recent version of Node.
RUN apt-get update -yq \
&& apt-get install curl gnupg -yq \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash \
&& apt-get install nodejs -yq
# Build docs
RUN bundle exec middleman build --clean
#
# Stage 3: build dev center
#
FROM ubuntu:19.10 as dev-center-builder
RUN apt-get update && \
apt-get install -y \
openssl ruby ruby-dev git zlib1g-dev cmake build-essential g++ imagemagick
RUN gem install bundler:1.16.2 && gem update --system
WORKDIR /opt/builds
COPY . .
RUN bundle install
COPY --from=style-builder /app/dist ./synapse/dist
RUN ./build.sh
#
# Final stage: use the build artifacts from previous stages
#
FROM node:10.14-slim
WORKDIR /opt/src/app
COPY --from=dev-center-builder /opt/builds/sites ./sites
COPY --from=docs-builder /opt/builds/build ./docs
COPY server/index.js ./server/index.js
COPY server/prometheus.js ./server/prometheus.js
COPY config ./config
COPY package.json package-lock.json ./
RUN npm install --production
# Add deployment artifacts to the image.
ADD deploy /opt/algorithmia/service/deploy
EXPOSE 3000
ENTRYPOINT [ "node", "server/index.js" ]