mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 04:12:17 +01:00
test: Add Docker container for testing [skip ci]
This commit is contained in:
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.*
|
||||||
|
|
||||||
|
!.eslintrc.json
|
||||||
|
!.prettierrc.json
|
||||||
|
|
||||||
|
coverage
|
||||||
|
node_modules
|
||||||
22
Makefile
Normal file
22
Makefile
Normal file
@@ -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
__tests__/Dockerfile
Normal file
11
__tests__/Dockerfile
Normal file
@@ -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" ]
|
||||||
Reference in New Issue
Block a user