Permalink
Browse files

feat(dockerfile): Addition of dockerfile for building Abstruse image

  • Loading branch information...
cooperaj committed Nov 7, 2017
1 parent 1f9a91a commit ae993ca26cc6879ecc94707b6c0aec12f3e24136
Showing with 59 additions and 0 deletions.
  1. +2 −0 .dockerignore
  2. +57 −0 Dockerfile
@@ -0,0 +1,2 @@
node_modules/*
dist/*
@@ -0,0 +1,57 @@
# Stage 1 image
FROM mhart/alpine-node:8 as base

LABEL maintainer="Jan Kuri <jan@bleenco.com>" \
org.label-schema.schema-version="1.0" \
org.label-schema.name="abstruse" \
org.label-schema.description="Continuous integration platform, simple, scalable and fast" \
org.label-schema.url="https://abstruse.bleenco.io/" \
org.label-schema.vcs-url="https://github.com/bleenco/abstruse" \
org.label-schema.vendor="Bleenco" \
org.label-schema.vcs-ref="n/a" \
org.label-schema.version="dev"

ENV DOCKER_VERSION=17.09.0-ce

RUN apk --no-cache add openssl \
&& wget https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz -O /tmp/docker.tgz \
&& mkdir /tmp/docker && tar xzf /tmp/docker.tgz -C /tmp \
&& ln -s /tmp/docker/docker /usr/bin/docker && chmod 755 /usr/bin/docker && rm -rf /tmp/docker.tgz \
&& apk del openssl

# Stage 2 image
FROM base as build

WORKDIR /app

COPY package.json package-lock.json tsconfig.json webpack.*.js /app/
COPY ./src /app/src

RUN apk add --no-cache --virtual .build-dependencies make gcc g++ python curl sqlite git \
&& npm set progress=false && npm config set depth 0 \
&& npm i --only=production \
&& cp -R node_modules prod_node_modules \
&& npm i && npm run build:prod && ls -lha /usr/lib/node_modules \
&& apk del .build-dependencies


# Stage 3 image
FROM alpine:3.6

WORKDIR /app

RUN apk --no-cache add tini sqlite git

COPY --from=base /usr/bin/node /usr/bin/
COPY --from=base /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/
COPY --from=base /tmp/docker/docker /usr/bin/docker

COPY --from=build /app/package.json /app/
COPY --from=build /app/prod_node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/src/files ./src/files

EXPOSE 6500

ENTRYPOINT ["/sbin/tini", "--"]
CMD [ "node", "dist/api/index.js" ]

0 comments on commit ae993ca

Please sign in to comment.