-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dockerfile): Addition of dockerfile for building Abstruse image
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/* | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ] |