Compare commits

...

9 Commits

Author SHA1 Message Date
c19d98521b Removed --prod flag
All checks were successful
Build Jtr app test image / test (push) Successful in 37s
2024-10-19 15:01:18 +02:00
1543926934 Trying ci with include dev flag
Some checks failed
Build Jtr app test image / test (push) Failing after 38s
2024-10-19 14:58:41 +02:00
c0b7d8c10e Trying npm install dev
Some checks failed
Build Jtr app test image / test (push) Failing after 36s
2024-10-19 14:56:11 +02:00
cbc4bcd670 Updated package.json
Some checks failed
Build Jtr app test image / test (push) Failing after 19s
2024-10-19 14:52:30 +02:00
0b98bc4e12 Trying npm ci
Some checks failed
Build Jtr app test image / test (push) Failing after 15s
2024-10-19 14:50:51 +02:00
6c7c34be09 Trying full path
Some checks failed
Build Jtr app test image / test (push) Failing after 15s
2024-10-19 14:49:29 +02:00
0ef66f6748 Fixed error
Some checks failed
Build Jtr app test image / test (push) Failing after 8s
2024-10-19 14:25:36 +02:00
c2b3688e76 Changed 'npm run build' to 'node_modules/.bin/ng build --prod'
Some checks failed
Build Jtr app test image / test (push) Failing after 9s
2024-10-19 14:24:29 +02:00
6b8d66559c Added build workflow
Some checks failed
Build Jtr app test image / test (push) Failing after 1m14s
2024-10-19 14:18:17 +02:00
4 changed files with 457 additions and 497 deletions

View File

@ -0,0 +1,42 @@
name: Build Jtr app test image
run-name: ${{ gitea.actor }} triggered a test build for the Jtr app
on: [ push ]
jobs:
test:
runs-on: ubuntu-latest
if: gitea.ref == 'refs/heads/develop'
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/setup-node@v4
with:
node-version: '20.x'
- name: "Build image"
run: |
IMAGE_NAME="git.devdisciples.com/devdisciples/jtr-app-test"
IMAGE_VERSION=$(npm pkg get version --workspaces=false | tr -d \")
VERSIONED_IMAGE_TAG="$IMAGE_NAME:$IMAGE_VERSION"
LATEST_IMAGE_TAG="$IMAGE_NAME:latest"
# Login to the registry
echo ${{ secrets.DOCKER_PASS }} | docker login git.devdisciples.com --username ${{ secrets.DOCKER_USER }} --password-stdin
# Check if the image exists.
# EXISTS = 0 if the image was found else 1.
EXISTS=$(docker manifest inspect $VERSIONED_IMAGE_TAG > /dev/null 2>&1; echo $?)
# If the image does not exist, then build it.
if [[ $EXISTS -eq 1 ]]; then
echo "Building image $VERSIONED_IMAGE_TAG"
docker build --build-arg API_URL="https://api.jtr.local" -t $VERSIONED_IMAGE_TAG -t $LATEST_IMAGE_TAG .
echo "Building image $VERSIONED_IMAGE_TAG"
docker push $VERSIONED_IMAGE_TAG
echo "Building image $LATEST_IMAGE_TAG"
docker push $LATEST_IMAGE_TAG
# Else notify the user that the image tag already exists and exit with status code 1.
else
echo "Image $VERSIONED_IMAGE_TAG already exists."
exit 1
fi

View File

@ -2,12 +2,11 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY . .
ARG API_URL="local"
ARG API_URL="https://api.jtr.local"
ENV JTR_API_URL=${API_URL}
ARG NODE_ENV="development"
ENV NODE_ENV=${NODE_ENV}
RUN npm install
RUN npm run build
ENV NODE_ENV="production"
RUN npm ci --include=dev
RUN ./node_modules/.bin/ng build
# Serve application
FROM nginx:alpine

901
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "jtr",
"version": "0.0.0",
"version": "0.0.1",
"scripts": {
"ng": "ng",
"start": "ng serve",