-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (44 loc) · 1.25 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
# Stage 1: Build the website
FROM node:12.14.1-alpine AS build
ARG PALANTIR_VERSION=0.10.3
# Install bins needed
RUN apk add --no-cache \
curl \
python \
make \
g++
RUN mkdir /app; \
mkdir /app-src
WORKDIR /app
# Get the source and extract them
RUN curl -o /app/palantir.tar.gz -fSL "https://github.com/CodeCorico/palantir/archive/v${PALANTIR_VERSION}.tar.gz"; \
tar zxvf palantir.tar.gz --strip-components=1; \
rm palantir.tar.gz; \
cp -R /app/* /app-src
# Install the deps & build the website
RUN npm ci; \
npm run build
# Stage 2: Install the cli & server
FROM node:12.14.1-alpine
ENV SERVER_PORT=80
ENV SERVER_STATICS=/palantir
ENV PALANTIR_FILE=/palantir/palantir.json
RUN mkdir /app; \
mkdir /palantir
WORKDIR /app
# Add the docker entrypoints
COPY ./docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Backwards compat
RUN ln -s usr/local/bin/docker-entrypoint.sh /
# Copy sources and dist from the build stage
COPY --from=build /app-src /app
COPY --from=build /app/dist /app/dist
# Install the production deps and install the cli as global
RUN npm ci --only=production; \
npm pack; \
npm i -g palantir-*.tgz; \
rm palantir-*.tgz
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["npm", "start"]