Skip to content

Commit 24597a8

Browse files
committed
run precious via docker compose
1 parent 38a2804 commit 24597a8

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ RUN mkdir -p var/t && chown metacpan var/t
9797
USER metacpan
9898
CMD [ "prove", "-l", "-r", "-j", "2", "t" ]
9999

100+
################### Dev Container (linting + tidying)
101+
FROM test AS dev
102+
SHELL [ "/bin/bash", "-euo", "pipefail", "-c" ]
103+
104+
USER root
105+
106+
COPY bin/install-precious /tmp/install-precious
107+
RUN /tmp/install-precious /usr/local/bin && rm /tmp/install-precious
108+
109+
USER metacpan
110+
CMD [ "bash" ]
111+
100112
################### Production Server
101113
FROM server AS production
102114

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,21 @@ For a full list of options:
138138
./bin/run bin/metacpan release --help
139139
```
140140

141+
## Linting and Tidying
142+
143+
Use the `api-dev` Docker service to run [precious](https://github.com/houseabsolute/precious) for linting and tidying. Use `bin/dc` instead of `docker compose` to ensure git worktrees are handled correctly.
144+
145+
```sh
146+
# tidy all files
147+
bin/dc run --rm api-dev precious tidy --all
148+
149+
# lint all files
150+
bin/dc run --rm api-dev precious lint --all
151+
152+
# lint only files changed since a branch
153+
bin/dc run --rm api-dev precious lint --git-diff-from origin/master
154+
```
155+
141156
## Contributing
142157

143158
If you'd like to get involved, find us at #metacpan on irc.perl.org or open an

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ services:
3737
networks:
3838
- elasticsearch
3939

40+
api-dev:
41+
profiles:
42+
- dev
43+
build:
44+
context: .
45+
target: dev
46+
volumes:
47+
- './:/app/'
48+
- '/app/local'
49+
- '${GIT_COMMON_DIR:-/dev/null}:${GIT_COMMON_DIR:-/dev/null}:ro'
50+
environment:
51+
COLUMNS: 120
52+
4053
elasticsearch-test:
4154
profiles:
4255
- test

0 commit comments

Comments
 (0)