From 2524fcf825317f5acef4944c6220e43f895bf611 Mon Sep 17 00:00:00 2001 From: runem Date: Wed, 6 Mar 2019 15:37:09 +0100 Subject: [PATCH 1/2] feat(docker): adds Dockerfile --- docker/.dockerignore | 2 ++ docker/Dockerfile | 20 ++++++++++++++++++++ docker/build.sh | 16 ++++++++++++++++ docker/start.js | 1 + 4 files changed, 39 insertions(+) create mode 100644 docker/.dockerignore create mode 100644 docker/Dockerfile create mode 100755 docker/build.sh create mode 100644 docker/start.js diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 0000000..62df2da --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +build.sh \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..998b1b3 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM node:10-alpine + +ARG VERSION=latest + +# Install deps +WORKDIR /polyfill + +# Use node-gyp / python and install +RUN apk add --no-cache --virtual .gyp \ + python \ + make \ + git \ + g++ \ + && npm install @wessberg/polyfiller@${VERSION} --no-optional --production \ + && apk del .gyp git python make g++ + +# Add source files +COPY ./ . + +CMD ["npm", "start"] diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 0000000..1520ee6 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +SCOPE=wessberg +NAME=polyfiller + +# Build latest +TAG=latest +docker build -t $NAME:$TAG -f ./Dockerfile . +docker tag $NAME:$TAG $SCOPE/$NAME +docker push $SCOPE/$NAME:$TAG + +# Build latest specific version +VERSION=$(npm view @wessberg/polyfiller version) +TAG=$VERSION +docker build -t $NAME:$TAG --build-arg VERSION=$VERSION -f ./Dockerfile . +docker tag $NAME:$TAG $SCOPE/$NAME:$TAG +docker push $SCOPE/$NAME:$TAG \ No newline at end of file diff --git a/docker/start.js b/docker/start.js new file mode 100644 index 0000000..e021eb3 --- /dev/null +++ b/docker/start.js @@ -0,0 +1 @@ +require("@wessberg/polyfiller"); From 79541a4fdb4e6b1e100a61c41ac4536755cec9e2 Mon Sep 17 00:00:00 2001 From: runem Date: Thu, 7 Mar 2019 12:34:14 +0100 Subject: [PATCH 2/2] refactor: Add package.json to the Docker image --- docker/package.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docker/package.json diff --git a/docker/package.json b/docker/package.json new file mode 100644 index 0000000..79ca608 --- /dev/null +++ b/docker/package.json @@ -0,0 +1,11 @@ +{ + "name": "polyfill", + "private": true, + "main": "start.js", + "scripts": { + "start": "node start.js" + }, + "engines": { + "node": ">=10.1.0" + } +}