forked from operator-framework/operatorhub.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis.Dockerfile
71 lines (51 loc) · 2.06 KB
/
travis.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
FROM alpine:3.12 as alpine_deps_builder
ENV DOCKERIZE_VERSION v0.6.1
ENV APP_ROOT=/app
ARG OPERATORS_REPO=https://github.com/operator-framework/community-operators
ARG OPERATORS_BRANCH=master
RUN apk add --no-cache git curl
WORKDIR ${APP_ROOT}
# prepare dockerize
RUN curl -#L -o dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -xzvf dockerize.tar.gz
# prepare upstream operators for server processing
RUN mkdir -p ${APP_ROOT}/server/data/community-operators \
&& mkdir -p /tmp/community-operators \
&& git clone --depth 1 -b $OPERATORS_BRANCH $OPERATORS_REPO
# build frontend dist files
FROM node:10.19.0-alpine as alpine_frontend_builder
ENV APP_ROOT=/app
WORKDIR ${APP_ROOT}
# root for build stages
USER root
COPY frontend/ ${APP_ROOT}/frontend
RUN cd ${APP_ROOT}/frontend; npm install \
&& npm run-script build
FROM node:10.19.0-buster-slim
#FROM node:10.19.0-alpine
ENV APP_ROOT=/app
ENV HOME=${APP_ROOT}
# root for build stages
# USER root
# RUN apk add --no-cache vips-dev
# gcc g++ make libc6-compat
# server
COPY server/ ${APP_ROOT}/server
RUN cd ${APP_ROOT}/server \
&& npm install \
&& npm run tsc \
&& rm -rf /opt/app-root/src/.npm /tmp/v8-compile-cache-0 ${APP_ROOT}/app/.config ${APP_ROOT}/.npm
COPY --from=alpine_deps_builder ${APP_ROOT}/dockerize /usr/local/bin/dockerize
# COPY --from=alpine_deps_builder ${APP_ROOT}/community-operators/upstream-community-operators ${APP_ROOT}/server/data/community-operators/upstream-community-operators
COPY --from=alpine_frontend_builder ${APP_ROOT}/frontend/dist ${APP_ROOT}/frontend/dist
# COPY --from=alpine_server_builder ${APP_ROOT}/server ${APP_ROOT}/server
### Setup user for build execution and application runtime
RUN chmod -R u+x ${APP_ROOT}/server/bin && \
chgrp -R 0 ${APP_ROOT} && \
chmod -R g=u ${APP_ROOT} /etc/passwd
### Containers should NOT run as root as a good practice
USER 1001
# Finalize
WORKDIR ${APP_ROOT}/server
ENTRYPOINT [ "/app/server/bin/uid_entrypoint" ]
EXPOSE 8080