Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Docker support #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
build.sh
20 changes: 20 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
16 changes: 16 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions docker/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "polyfill",
"private": true,
"main": "start.js",
"scripts": {
"start": "node start.js"
},
"engines": {
"node": ">=10.1.0"
}
}
1 change: 1 addition & 0 deletions docker/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("@wessberg/polyfiller");