Skip to content

Commit

Permalink
feat(dockerfile): Addition of dockerfile for building Abstruse image
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperaj committed Nov 7, 2017
1 parent 1f9a91a commit ae993ca
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
dist/*
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Stage 1 image
FROM mhart/alpine-node:8 as base

LABEL maintainer="Jan Kuri <[email protected]>" \
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.