diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 9db5c41..03402c2 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -1,11 +1,14 @@ +environment: + IMAGE_TAG: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7} + steps: build-frontend: name: Build & Push Frontend image: woodpeckerci/plugin-kaniko when: - event: [ push, pull_request, tag, manual ] # 👈 allow manual run + event: [ push, pull_request, tag, manual ] path: - include: [ frontend/** ] # 👈 filter for auto-trigger + include: [ frontend/** ] settings: registry: harbor.dvirlabs.com repo: my-apps/labmap-frontend @@ -13,7 +16,7 @@ steps: context: frontend tags: - latest - - ${CI_COMMIT_SHA:0:7} + - ${IMAGE_TAG} username: from_secret: DOCKER_USERNAME password: @@ -33,8 +36,27 @@ steps: context: backend tags: - latest - - ${CI_COMMIT_SHA:0:7} + - ${IMAGE_TAG} username: from_secret: DOCKER_USERNAME password: from_secret: DOCKER_PASSWORD + + patch-my-apps: + name: Patch Helm Values + image: alpine:3.19 + when: + event: [ push ] + commands: + - apk add --no-cache git curl yq + - git config --global user.name "Woodpecker Bot" + - git config --global user.email "ci@dvirlabs.com" + - git clone https://${GIT_USERNAME}:${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git + - cd my-apps/manifests/labmap + - yq -i ".image.tag = \"${IMAGE_TAG}\"" values.yaml + - git add values.yaml + - git commit -m "Update labmap image tag to ${IMAGE_TAG}" + - git push origin master + secrets: + - GIT_TOKEN + - GIT_USERNAME diff --git a/frontend/Dockerfile b/frontend/Dockerfile index c1d9c23..8d4cdd8 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,25 +1,21 @@ -# Stage 1: Build the frontend -FROM node:20 AS builder - -WORKDIR /app -COPY . . - -RUN npm install -RUN npm run build - -# Stage 2: Serve with nginx FROM nginx:alpine +# Install dos2unix to convert Windows line endings +RUN apk add --no-cache dos2unix + # Copy built app COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf -# Copy the runtime env template + entrypoint +# Copy entrypoint + env template COPY public/env.js.template /usr/share/nginx/html/env.js.template COPY docker-entrypoint.sh /entrypoint.sh +# Fix line endings +RUN dos2unix /entrypoint.sh + RUN chmod +x /entrypoint.sh EXPOSE 80 diff --git a/labmap-chart/values.yaml b/labmap-chart/values.yaml index 462b52b..b333568 100644 --- a/labmap-chart/values.yaml +++ b/labmap-chart/values.yaml @@ -12,4 +12,4 @@ backend: port: 8000 ingress: enabled: false - host: api.labmap.dvirlabs.com + host: api-labmap.dvirlabs.com