Skip to content

Commit

Permalink
Merge branch 'main' into feat-test2
Browse files Browse the repository at this point in the history
  • Loading branch information
barrfalk authored Jan 31, 2024
2 parents ea02c2c + cc407f9 commit b3cad47
Show file tree
Hide file tree
Showing 27 changed files with 1,436 additions and 737 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ jobs:
env:
FLYWAY_VALIDATE_MIGRATION_NAMING: true
FLYWAY_LOCATIONS: filesystem:./migrations
FLYWAY_DEFAULT_SCHEMA: "users"
FLYWAY_DEFAULT_SCHEMA: "case_management"

- name: Create Output Folder
run: |
mkdir output
chmod a+rwx -R output
- name: Run Schemaspy
run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql -db default -host 127.0.0.1 -port 5432 -u default -p default -schemas users
run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql -db default -host 127.0.0.1 -port 5432 -u default -p default -schemas case_management
- name: Deploy to Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
# Keep environment variables out of version control
.env
28 changes: 22 additions & 6 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# Build static files
# Node Bullseye has npm
FROM node:20.10.0-bullseye-slim AS build
FROM node:20.11.0-bullseye-slim AS buildWithDevDeps

# Install packages, build and keep only prod packages
WORKDIR /app
COPY *.json ./
COPY ./src ./src
RUN npm ci --ignore-scripts --no-update-notifier --omit=dev && \
npm run build
COPY ./prisma ./prisma
RUN npm ci --ignore-scripts --no-update-notifier
RUN npm run prisma-generate
FROM node:20.11.0-bullseye-slim AS build

# Install packages, build and keep only prod packages
WORKDIR /app
COPY *.json ./
COPY ./src ./src
COPY ./prisma ./prisma
RUN npm ci --ignore-scripts --no-update-notifier --omit=dev

# COPY over few dependencies from buildWithDevDeps
COPY --from=buildWithDevDeps /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=buildWithDevDeps /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=buildWithDevDeps /app/node_modules/prisma ./node_modules/prisma

RUN npm run build

# Deploy container
# Distroless has node, but not npm
Expand All @@ -20,9 +36,9 @@ COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist

# Ports, health check and non-root user
EXPOSE 3002
HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/:3002/api || exit 1
USER app
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/:3000/api || exit 1
USER nonroot

# Start up command with 50MB of heap size, each application needs to determine what is the best value. DONT use default as it is 4GB.
CMD ["--max-old-space-size=50", "/app/dist/main"]
Loading

0 comments on commit b3cad47

Please sign in to comment.