Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 4 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,10 @@
version: 2.1

orbs:
node: circleci/node@5.1.0
docker: circleci/docker@2.4.0

jobs:
build-and-test:
docker:
- image: cimg/node:20.11.0
environment:
DATABASE_URL: 'postgres://postgres@localhost/app'
AWS_S3_ACCESS_KEY_ID: 'minioadmin'
AWS_S3_SECRET_ACCESS_KEY: 'minioadmin'
AWS_S3_BUCKET: 'app'
AWS_S3_ENDPOINT: 'http://localhost:9000'
AWS_S3_REGION: 'us-east-1'
- image: cimg/postgres:15.5
environment:
POSTGRES_HOST_AUTH_METHOD: trust
- image: minio/minio:RELEASE.2024-02-14T21-36-02Z
command: minio server /home/data
steps:
- checkout
- restore_cache:
key: v1-deps-{{ checksum "package-lock.json" }}
- run:
command: npm install
- save_cache:
key: v1-deps-{{ checksum "package-lock.json" }}
paths:
- server/node_modules
- client/node_modules
- node_modules
- run:
command: cd server && npx sequelize db:create --env test
- run:
command: cd server && npx sequelize db:migrate --env test
- run:
command: eval $(cat example.env | grep -v -E "DATABASE_URL|AWS_[^=]+" | sed 's/^/export /'); cd server; bin/create-bucket.js app; cd ..; npm run test
noop:
type: no-op

workflows:
test:
noop:
jobs:
- build-and-test
- noop
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI
on:
push:
branches:
- "dev"
- "main"
pull_request:
types: [opened, reopened, synchronize]

jobs:
ci:
name: CI
runs-on: ubuntu-latest
container: node:22.12.0-bookworm
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up npm cache
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Generate Prisma client
run: cd server && npx prisma generate
- name: Run ESLint
run: npm run lint
- name: Run Tests
run: cp server/example.env server/.env && npm test
71 changes: 62 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,64 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# 0x
profile-*

# mac files
.DS_Store

# vim swap files
*.swp

# webstorm
.idea

# vscode
.vscode
*code-workspace

# clinic
profile*
*clinic*
*flamegraph*

# project specific
.env
data/*
server/public/assets
server/public/uploads
tmp
dist
node_modules
webpack-stats.json
**/artifact.zip
**/*.pem
data
*.pem
*.zip
42 changes: 24 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# Start with the latest Node.js LTS release
FROM node:20.11.1-bookworm
FROM node:22.12.0-bookworm

# Support for multi-architecture builds
ARG TARGETARCH

# Set an env variable for the location of the app files
ENV APP_HOME=/opt/node/app

# update path to include any installed node module executables
RUN echo "export PATH=$APP_HOME/node_modules/.bin:~/minio-binaries:\$PATH\n" >> /root/.bashrc

# Install postgres dependencies
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" >> /etc/apt/sources.list.d/pgdg.list && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
chmod a+r /etc/apt/keyrings/docker.gpg && \
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update -y && \
apt-get install -y docker-ce-cli docker-buildx-plugin jq less postgresql-client-15 zip && \
apt-get clean && \
curl https://dl.min.io/client/mc/release/linux-$TARGETARCH/mc --create-dirs -o ~/minio-binaries/mc && \
chmod +x ~/minio-binaries/mc
apt-get install -y postgresql-client-17 && \
apt-get clean

# Install docker dependencies
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update -y && \
apt-get install -y docker-ce-cli docker-buildx-plugin && \
apt-get clean

RUN if [ "$TARGETARCH" = "amd64" ]; then \
# Install AWS cli dependencies
RUN apt-get install -y jq less zip && \
if [ "$TARGETARCH" = "amd64" ]; then \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"; \
elif [ "$TARGETARCH" = "arm64" ]; then \
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"; \
Expand All @@ -32,13 +37,14 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
rm awscliv2.zip && \
rm -Rf aws

# update path to include any installed node module executables
RUN echo "export PATH=./node_modules/.bin:\$PATH\n" >> /root/.bashrc

# Create a directory for the server app to run from
RUN mkdir -p $APP_HOME

# Add the project files into the app directory
# Add the project files into the app directory and set as working directory
ADD . $APP_HOME

# Set workdir
WORKDIR $APP_HOME

# Install dependencies, build client app
Expand All @@ -47,4 +53,4 @@ RUN npm install && \

# Set up default command to run Node on port 3000
EXPOSE 3000
CMD ["./node_modules/.bin/pm2-runtime", "./server/bin/www.js"]
CMD ["./node_modules/.bin/pm2-runtime", "npm", "--", "start", "-w", "server"]
Loading
Loading