Add initial docker file for quick goldilocks testing

This commit is contained in:
Tim Caswell 2017-06-23 15:42:25 -05:00
parent 7a2f0f0984
commit 3f5ac75e4c
2 changed files with 50 additions and 0 deletions

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
# This is for alpine base
FROM node:alpine
RUN apk update
RUN apk upgrade
RUN apk add curl git libcap htop
# This for ubuntu base
# FROM node
# RUN apt-get update
# RUN apt-get dist-upgrade -y
# RUN apt-get install curl git libcap2 htop -y
# Allow node to listen on ports 80 and 443 as normal user.
RUN setcap cap_net_bind_service=+ep $(readlink -f $(which node))
WORKDIR /opt/goldilocks
# Copy in just package.json and install npm dependencies first
COPY package.json /opt/goldilocks/
RUN yarn install
# Then copy in the rest and link as global binary
COPY . /opt/goldilocks/
RUN yarn link
# Copy in a goldilocks config to test it.
# TODO: pull this from the user somehow
COPY etc/goldilocks/goldilocks.example.yml /opt/goldilocks/etc/goldilocks/goldilocks.yml
# Run as unpriviledged user
USER node
EXPOSE 80 443 5353
CMD ["/usr/local/bin/goldilocks"]

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
run: build
docker run --rm --net=host -d --name goldilocks daplie/goldilocks
logs:
docker logs goldilocks -f
build:
docker build . --tag daplie/goldilocks
rebuild:
docker build . --no-cache --tag daplie/goldilocks
shell:
docker exec -ti goldilocks ash
htop:
docker exec -ti goldilocks htop
kill:
docker kill goldilocks || true
clean: kill
docker rm -f goldilocks || true
docker rmi -f daplie/goldilocks || true