Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
chore: add docker build step to travis [build-image] (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Sep 27, 2017
1 parent effb4a3 commit 134bee0
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.idea
.git
packages
node_modules
.travis.yml
package-lock.json
Dockerfile
CHANGELOG.md
README.md
test-config.json
test/
.env.example
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
.nyc_output
package-lock.json
18 changes: 18 additions & 0 deletions .kicker.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name = "couch-url-rewrite-proxy"
description = "a proxy that rewrites URLs on their way out of couch, making registry migrations easier"
start = "./bin/couch-url-rewrite-proxy.js start"

[environment]
FRONT_DOOR_URL = "{{front_door_url}}"
PORT = "{{port}}"
UPSTREAM_URL = "{{upstream_url}}"

[default]
FRONT_DOOR_URL = "https://registry.example.com"
PORT = 5001
UPSTREAM_URL = "http://127.0.0.1:5000"

[argument]
front-door-host = "FRONT_DOOR_HOST"
port = "PORT"
upstream = "UPSTREAM_URL"
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
sudo: required
services:
- docker
language: node_js
node_js:
- "4"
- "node"
- "6"
- "8"
before_install:
- npm i dockyard@latest -g
- printf "@npm:registry=https://enterprise.npmjs.com" >> ~/.npmrc
after_success: npm run coverage

after_success:
- npm run coverage
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- dockyard build image --repo=npmjs --name=couch-url-rewrite-proxy
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Set the base image to alpine Node LTS
FROM npmjs/npm-docker-baseline:6-alpine

# File Author / Maintainer
MAINTAINER Alex Robson

WORKDIR /app/src
COPY ./bin/ /app/src/bin/
COPY ./package.json /app/src/
COPY ./server.js /app/src/
COPY ./.kicker.toml /app/src/

RUN echo '@npm:registry=https://enterprise.npmjs.com/' >> ~/.npmrc && \
cat ~/.npmrc && \
npm install && \
rm ~/.npmrc

RUN npm uninstall node-gyp -g && apk del python make g++ && rm -rf /var/cache/apk/*

EXPOSE 8080
3 changes: 3 additions & 0 deletions build-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build . -t npme-url-rewrite-proxy
6 changes: 6 additions & 0 deletions scripts/start-service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

node ./bin/couch-url-rewrite-proxy.js start \
--port=8080 \
--front-door-host=$FRONT_DOOR_HOST \
--upstream=$UPSTREAM
18 changes: 18 additions & 0 deletions start-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

if [[ $1 == debug ]]; then
docker run -it --rm --name npme-url-rewrite-proxy \
-e FRONT_DOOR_HOST=172.16.123.1 \
-e PORT=8080 \
-e UPSTREAM=http://172.16.123.1:5984/upstream \
-p 8080:8080 \
npme-url-rewrite-proxy
bash
else
docker run -d --name npme-url-rewrite-proxy \
-e FRONT_DOOR_HOST=172.16.123.1 \
-e PORT=8080 \
-e UPSTREAM=http://172.16.123.1:5984/upstream \
-p 8080:8080 \
npme-url-rewrite-proxy
fi

0 comments on commit 134bee0

Please sign in to comment.