Skip to content

Commit

Permalink
test: Add Docker container for testing [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Jan 17, 2020
1 parent dc95764 commit 7496c44
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.*

!.eslintrc.json
!.prettierrc.json

coverage
node_modules
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmd := "bash"
msg := ""
IMAGE_NAME := actions-hugo-dev:latest
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --file ./__tests__/Dockerfile
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/etc/gitconfig $(IMAGE_NAME)


.PHONY: build
build:
$(DOCKER_BUILD)

.PHONY: run
run:
$(DOCKER_RUN) $(cmd)

.PHONY: test
test:
$(DOCKER_RUN) npm test

.PHONY: commit
commit:
$(DOCKER_RUN) git commit -m "$(msg)"
11 changes: 11 additions & 0 deletions __tests__/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:12-slim

WORKDIR /repo

RUN apt-get update && \
apt-get -y install --no-install-recommends \
git \
bash && \
rm -rf /var/lib/apt/lists/*

CMD [ "bash" ]

0 comments on commit 7496c44

Please sign in to comment.