Skip to content

Commit

Permalink
ci: add CircleCI and ci docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Guthe committed May 13, 2021
1 parent c17d1d9 commit fc317cc
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 3 deletions.
50 changes: 50 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,50 @@
version: 2.1

workflows:
test:
jobs:
- test

jobs:
test:
docker:
- image: node:12
# auth:
# username: $DOCKER_USER
# password: $DOCKER_PASS
# working_directory: ~/
steps:
- checkout
- run:
name: Install curl and git
command: |
apt-get update -y && apt-get install -y curl git
- run:
name: Install Docker
command: |
apt-get install -y apt-transport-https ca-certificates gnupg lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y && apt-get install -y docker-ce docker-ce-cli containerd.io
- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m) > ~/docker-compose
chmod +x ~/docker-compose
mv ~/docker-compose /usr/local/bin/docker-compose
- setup_remote_docker
- run:
name: build web-ci and test-ci
command: |
/usr/local/bin/docker-compose build web-ci test-ci
- run:
name: run web and cache with Docker Compose
command: |
/usr/local/bin/docker-compose up -d web-ci
- run:
name: install node deps
command: npm ci
- run:
name: test
command: /usr/local/bin/docker-compose run --rm test-ci
16 changes: 13 additions & 3 deletions .dockerignore
@@ -1,3 +1,13 @@
/\.*
/node_modules
/package-lock.json
.git/
.gitignore
.circleci/
.travis.yml

node_modules/
Dockerfile
docker-compose.yml

coverage
.nyc_output/

*.tgz
11 changes: 11 additions & 0 deletions Dockerfile
@@ -0,0 +1,11 @@
FROM node:12-alpine

COPY ./package.json /app/
COPY ./package-lock.json /app/

WORKDIR /app

RUN npm ci
ADD . /app/

CMD ["npm", "test"]
19 changes: 19 additions & 0 deletions docker-compose.yml
Expand Up @@ -24,3 +24,22 @@ services:
- ${PWD}:/ip-reputation-js-client-test
working_dir: /ip-reputation-js-client-test
command: npm test

web-ci:
build:
context: test/
volumes:
- ${PWD}/test/iprepd.yaml:/app/iprepd.yaml
links:
- cache
expose:
- "8080"

test-ci:
build:
context: .
environment:
- IPREPD_ADDR=web:8080
links:
- web
command: npm test
7 changes: 7 additions & 0 deletions test/Dockerfile
@@ -0,0 +1,7 @@
FROM mozilla/iprepd

COPY ./iprepd.yaml /app/iprepd.yaml

EXPOSE 8080

CMD ["bin/iprepd"]

0 comments on commit fc317cc

Please sign in to comment.