Skip to content

Commit

Permalink
v2 initial
Browse files Browse the repository at this point in the history
  • Loading branch information
w41x committed Mar 20, 2024
1 parent cd72c9d commit 8b7baa1
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 3 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# syntax = docker/dockerfile:1.4.1

FROM node:21.7.1-alpine3.19 AS payload
LABEL name='api build'
# enable pnpm
RUN corepack enable
RUN corepack prepare pnpm@8.15.5 --activate
# set user and working directory and copy all project files
USER node
WORKDIR /home/node/workspace
COPY --chown=node . .
# set environment variables
ENV NODE_ENV development
# install node modules for plugin
# RUN pnpm install
# ENV PATH /home/node/workspace/node_modules/.bin:$PATH
# build plugin
# RUN pnpm run build
# set working directory for test environment
WORKDIR /home/node/workspace/dev
# install node module for test environment
RUN pnpm install
ENV PATH /home/node/workspace/dev/node_modules/.bin:$PATH
# set internal port
EXPOSE 3000
# start test environment
CMD pnpm run dev

FROM mongo:7.0.6-jammy as db
LABEL name='db build'
# database config
ENV MONGO_INITDB_ROOT_USERNAME=root
ENV MONGO_INITDB_ROOT_PASSWORD=secret
# set internal port
EXPOSE 27017
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
start:
docker compose up
5 changes: 5 additions & 0 deletions dev/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules

.gitignore

Makefile
1 change: 1 addition & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions dev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gen:
export PAYLOAD_CONFIG_PATH=src/config/payload.config.ts && pnpm run generate:types
4 changes: 2 additions & 2 deletions dev/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payload-bidirectional-relationships-plugin-dev",
"version": "0.1.0-v2",
"version": "0.1.1-v2",
"description": "development environment for payload-bidirectional-relationships-plugin",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"@payloadcms/bundler-webpack": "^1.0.6",
"@payloadcms/db-mongodb": "^1.4.3",
"@payloadcms/richtext-lexical": "^0.7.0",
"payload-bidirectional-relationships-plugin": "^0.1.0-v2",
"payload-bidirectional-relationships-plugin": "^0.1.1-v2",
"express": "^4.19.0",
"payload": "^2.11.2"
},
Expand Down
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.9'

services:

#api development build
payload:
build:
target: payload
image: payload:dev
ports:
- target: 3000
published: 80
protocol: tcp
mode: host
depends_on:
- db
restart: unless-stopped
#enabling hot reload by binding the project folder
volumes:
- type: bind
source: ./
target: /home/node/workspace


#db development build
db:
build:
target: db
image: db:dev
restart: unless-stopped
volumes:
- type: volume
source: data
target: /data/db

networks:
default:
name: workspace-dev

volumes:
data:
name: workspace-vol-data
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payload-bidirectional-relationships-plugin",
"version": "0.1.0-v2",
"version": "0.1.1-v2",
"description": "plugin for Payload CMS, which enables bidirectional relationships",
"type": "module",
"license": "MIT",
Expand Down

0 comments on commit 8b7baa1

Please sign in to comment.