|
| 1 | +# Stage 1 image |
| 2 | +FROM mhart/alpine-node:8 as base |
| 3 | + |
| 4 | +LABEL maintainer="Jan Kuri <jan@bleenco.com>" \ |
| 5 | + org.label-schema.schema-version="1.0" \ |
| 6 | + org.label-schema.name="abstruse" \ |
| 7 | + org.label-schema.description="Continuous integration platform, simple, scalable and fast" \ |
| 8 | + org.label-schema.url="https://abstruse.bleenco.io/" \ |
| 9 | + org.label-schema.vcs-url="https://github.com/bleenco/abstruse" \ |
| 10 | + org.label-schema.vendor="Bleenco" \ |
| 11 | + org.label-schema.vcs-ref="n/a" \ |
| 12 | + org.label-schema.version="dev" |
| 13 | + |
| 14 | +ENV DOCKER_VERSION=17.09.0-ce |
| 15 | + |
| 16 | +RUN apk --no-cache add openssl \ |
| 17 | + && wget https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz -O /tmp/docker.tgz \ |
| 18 | + && mkdir /tmp/docker && tar xzf /tmp/docker.tgz -C /tmp \ |
| 19 | + && ln -s /tmp/docker/docker /usr/bin/docker && chmod 755 /usr/bin/docker && rm -rf /tmp/docker.tgz \ |
| 20 | + && apk del openssl |
| 21 | + |
| 22 | +# Stage 2 image |
| 23 | +FROM base as build |
| 24 | + |
| 25 | +WORKDIR /app |
| 26 | + |
| 27 | +COPY package.json package-lock.json tsconfig.json webpack.*.js /app/ |
| 28 | +COPY ./src /app/src |
| 29 | + |
| 30 | +RUN apk add --no-cache --virtual .build-dependencies make gcc g++ python curl sqlite git \ |
| 31 | + && npm set progress=false && npm config set depth 0 \ |
| 32 | + && npm i --only=production \ |
| 33 | + && cp -R node_modules prod_node_modules \ |
| 34 | + && npm i && npm run build:prod && ls -lha /usr/lib/node_modules \ |
| 35 | + && apk del .build-dependencies |
| 36 | + |
| 37 | + |
| 38 | +# Stage 3 image |
| 39 | +FROM alpine:3.6 |
| 40 | + |
| 41 | +WORKDIR /app |
| 42 | + |
| 43 | +RUN apk --no-cache add tini sqlite git |
| 44 | + |
| 45 | +COPY --from=base /usr/bin/node /usr/bin/ |
| 46 | +COPY --from=base /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/ |
| 47 | +COPY --from=base /tmp/docker/docker /usr/bin/docker |
| 48 | + |
| 49 | +COPY --from=build /app/package.json /app/ |
| 50 | +COPY --from=build /app/prod_node_modules ./node_modules |
| 51 | +COPY --from=build /app/dist ./dist |
| 52 | +COPY --from=build /app/src/files ./src/files |
| 53 | + |
| 54 | +EXPOSE 6500 |
| 55 | + |
| 56 | +ENTRYPOINT ["/sbin/tini", "--"] |
| 57 | +CMD [ "node", "dist/api/index.js" ] |
0 commit comments