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
52 changes: 44 additions & 8 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,33 @@ jobs:
with:
node-version: '22'

- name: install dependencies
run: npm i
- name: Install root dependencies
run: npm ci

- name: dependency check
- name: Run dependency check
run: npm run dependencyCheck

- name: run all tests
- name: Run all tests
run: npm test

- name: Run prebuild checks
run: |
npm run docu
node build/checkTranslationKeys.mjs

- name: Build client
working-directory: client
env:
VITE_PUBLIC_POSTHOG_KEY: ${{ vars.VITE_PUBLIC_POSTHOG_KEY }}
VITE_PUBLIC_POSTHOG_HOST: ${{ vars.VITE_PUBLIC_POSTHOG_HOST }}
run: |
npm ci
npm run build

- name: Install server dependencies
working-directory: server
run: npm ci

- name: Log in to GitHub Container Registry
if: inputs.push_image
uses: docker/login-action@v3
Expand All @@ -39,13 +57,31 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build app & docker image
- name: Get git info
id: git-info
run: |
echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "tags=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT

- name: Build and tag Docker image
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_USERNAME: ${{ github.repository_owner }}
VITE_PUBLIC_POSTHOG_KEY: ${{ secrets.VITE_PUBLIC_POSTHOG_KEY }}
VITE_PUBLIC_POSTHOG_HOST: ${{ secrets.VITE_PUBLIC_POSTHOG_HOST }}
run: npm run build:dockerImage
run: |
DOCKER_USER="${DOCKER_USERNAME,,}"
BASE_TAG="$DOCKER_REGISTRY/$DOCKER_USER/poinz"

# Build with all tags
TAGS_ARG="-t $BASE_TAG:latest"
if [ ! -z "${{ steps.git-info.outputs.tags }}" ]; then
for tag in ${{ steps.git-info.outputs.tags }}; do
TAGS_ARG="$TAGS_ARG -t $BASE_TAG:$tag"
done
fi

echo "Building docker image for commit ${{ steps.git-info.outputs.hash }} on branch ${{ steps.git-info.outputs.branch }}"
docker build $TAGS_ARG --network=host .

- name: Push Docker image
if: inputs.push_image
Expand Down
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
# let's use node 18.x on Debian 11 ("bullseye") see https://hub.docker.com/_/node
FROM node:18-bullseye

# Create app directories
RUN mkdir -p /usr/src/poinz/public
RUN mkdir -p /usr/src/poinz/src
WORKDIR /usr/src/poinz

# Bundle app source
COPY deploy/public /usr/src/poinz/public
COPY deploy/src /usr/src/poinz/src
COPY deploy/package.json /usr/src/poinz/
COPY deploy/package-lock.json /usr/src/poinz/
COPY client/dist /usr/src/poinz/public

COPY server/package.json /usr/src/poinz/
COPY server/package-lock.json /usr/src/poinz/
ENV NODE_ENV=production

COPY server/src /usr/src/poinz/src

# install app dependencies
RUN npm install --omit=dev

# expose port 3000
EXPOSE 3000

CMD npm start
46 changes: 0 additions & 46 deletions build/build.mjs

This file was deleted.

30 changes: 0 additions & 30 deletions build/buildUtils.mjs

This file was deleted.

63 changes: 0 additions & 63 deletions build/dockerImage.mjs

This file was deleted.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"ft": "npm run format && npm t",
"format": "cd client/ && npm run format && cd ../server/ && npm run format && cd ../poinz-e2e/ && npm run format && cd ../ && prettier --write \"build/*.mjs\" \"docu/**/*.mjs\" ",
"test": "cd client/ && npm test && cd ../server && npm test",
"prebuild": "node build/checkTranslationKeys.mjs && npm run docu",
"build": "node build/build.mjs",
"build:dockerImage": "npm run build && node build/dockerImage.mjs",
"dependencyCheck": "ncu --packageFile ./package.json > npm_dependencies_report.poinz.md && ncu --packageFile ./client/package.json > npm_dependencies_report.poinz-client.md && ncu --packageFile ./server/package.json > npm_dependencies_report.poinz-server.md && ncu --packageFile ./poinz-e2e/package.json > npm_dependencies_report.poinz-e2e.md",
"postinstall": "cd client/ && npm i && cd ../server && npm i",
"docu": "node docu/src/docuGenerator.mjs",
Expand Down