Skip to content

Commit 0c302e6

Browse files
authored
Merge pull request #72 from metacpan/docker-dev
Multiple improvements during recent PTS25
2 parents 82fe00e + 5f5ef1a commit 0c302e6

File tree

110 files changed

+4147
-2365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+4147
-2365
lines changed

.docker/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ~/.docker/config.json
2+
{
3+
"features": {
4+
"buildkit": true
5+
}
6+
}

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .dockerignore
2+
3+
.git
4+
.gitignore
5+
6+
README.md
7+
8+
deploy/
9+
launcher/
10+
local/
11+
12+
src/blib/
13+
src/environments/*docker*
14+
src/lib/
15+
src/public/
16+
src/t/
17+
src/var/
18+
src/views/
19+
20+
tools/
21+
22+
.env
23+
*.log
24+
*.swp

ISSUE_TEMPLATE.md renamed to .github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
---
2+
name: 🐛 Bug report
3+
about: Report a problem with the app
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
110
## Context
211

312
[provide more detailed introduction to the issue itself and why it is relevant]

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 💬 Community Support
4+
url: //github.com/metacpan/metacpan-grep-front-end/discussions/
5+
about: Please use GitHub Discussions for questions and support.

.github/workflows/build-production-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Build deployment container
2+
name: Build production container
33
on:
44
push:
55
branches:

.github/workflows/testsuite.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Run testsuite for grep.metacpan
2+
3+
on:
4+
push:
5+
# branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Checkout the main repo
14+
- name: Checkout current repo
15+
uses: actions/checkout@v4
16+
with:
17+
path: main-repo
18+
19+
# Checkout the metacpan-cpan-extracted-lite repo
20+
- name: Checkout CPAN repo
21+
uses: actions/checkout@v4
22+
with:
23+
repository: metacpan/metacpan-cpan-extracted-lite
24+
path: metacpan-cpan-extracted-lite
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Setup container
28+
run: |
29+
cd main-repo
30+
make test-setup
31+
32+
# Set up Docker Compose
33+
- name: Run tests
34+
run: |
35+
cd main-repo
36+
make test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.DS_Store
2+
.env
23
.tidyall.d
34
MYMETA.json
45
MYMETA.yml
5-
Makefile
66
blib
77
local
88
pm_to_blib

.travis.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

Dockerfile

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,53 @@
1-
FROM metacpan/metacpan-base:latest
1+
##
2+
## Temporary image for installing metacpan packages
3+
##
4+
5+
FROM metacpan/metacpan-base:latest AS builder
6+
SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]
7+
8+
# copy the cpanfile and cpanfile.snapshot
9+
# from the current directory to the /cpan directory in the image
10+
# and install the dependencies using cpm
11+
# we could then reuse the cpanfile and cpanfile.snapshot for testing
12+
WORKDIR /cpan
13+
14+
COPY cpanfile ./
15+
COPY cpanfile.snapshot ./
16+
17+
RUN <<EOT
18+
cpm install -g \
19+
--without-test \
20+
--with-recommends \
21+
--with-develop \
22+
--cpanfile cpanfile
23+
EOT
24+
25+
##
26+
## Runtime image for metacpan-grep-front-end
27+
##
28+
29+
FROM builder AS runtime
30+
SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]
231

3-
ADD . /metacpan-grep-front-end
432
WORKDIR /metacpan-grep-front-end
533

6-
RUN cpm install --without-test -g
34+
# Build arguments
35+
ARG APP_ENV=development
36+
37+
# Runtime
38+
ENV APP_ENV=$APP_ENV
39+
40+
# .dockerignore is used to exclude files from the build context
41+
COPY src/ ./
42+
43+
# always expose a consistent port
744
EXPOSE 3000
45+
# volume controlled by the docker-compose.yml
846
VOLUME [ "/metacpan-cpan-extracted" ]
9-
CMD plackup -p 3000 ${GREP_PLACKUP_SERVER_ARGS} bin/app.psgi
47+
48+
# Make the entrypoint script executable
49+
RUN chmod +x docker-entrypoint.sh
50+
51+
# Use the dynamic entrypoint
52+
ENTRYPOINT ["./docker-entrypoint.sh"]
53+
CMD ["serve"]

MANIFEST

Lines changed: 0 additions & 24 deletions
This file was deleted.

MANIFEST.SKIP

Lines changed: 0 additions & 17 deletions
This file was deleted.

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
.PHONY: all up-dev up-prod up test test-setup t
3+
4+
APP_ENV ?= development
5+
DOCKER_ENV := $(if $(filter $(APP_ENV),test-setup),test,$(APP_ENV))
6+
7+
# Add overload config for docker-compose
8+
ifeq ($(APP_ENV),development)
9+
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml
10+
else ifeq ($(APP_ENV),test-setup)
11+
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml:docker-compose.test-setup.yml
12+
else ifeq ($(APP_ENV),test)
13+
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml:docker-compose.test.yml
14+
else
15+
COMPOSE_FILE=docker-compose.yml
16+
endif
17+
18+
all:
19+
$(MAKE) up
20+
21+
up:
22+
ln -sf config/docker-compose.$(DOCKER_ENV).env .env
23+
APP_ENV=$(DOCKER_ENV) docker compose -f $(subst :, -f ,$(COMPOSE_FILE)) up --build --exit-code-from grep
24+
25+
up-dev:
26+
$(MAKE) up APP_ENV=development
27+
28+
up-prod:
29+
$(MAKE) up APP_ENV=production
30+
31+
t: test
32+
33+
test-setup:
34+
$(MAKE) up APP_ENV=test-setup
35+
36+
test:
37+
$(MAKE) up APP_ENV=test
38+
39+
bash:
40+
docker exec -it grep-container /bin/bash

Makefile.PL

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)