diff --git a/.woodpecker.yaml b/.woodpecker.yaml index e66e627..944af38 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -1,24 +1,24 @@ steps: - # build-frontend: - # name: Build & Push Frontend - # image: woodpeckerci/plugin-kaniko - # when: - # branch: [ master, develop ] - # event: [ push, pull_request, tag ] - # path: - # include: [ frontend/** ] - # settings: - # registry: harbor.dvirlabs.com - # repo: my-apps/${CI_REPO_NAME}-frontend - # dockerfile: frontend/Dockerfile - # context: frontend - # tags: - # - latest - # - ${CI_COMMIT_TAG:-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}} - # username: - # from_secret: DOCKER_USERNAME - # password: - # from_secret: DOCKER_PASSWORD + build-frontend: + name: Build & Push Frontend + image: woodpeckerci/plugin-kaniko + when: + branch: [ master, develop ] + event: [ push, pull_request, tag ] + path: + include: [ frontend/** ] + settings: + registry: harbor.dvirlabs.com + repo: my-apps/${CI_REPO_NAME}-frontend + dockerfile: frontend/Dockerfile + context: frontend + tags: + - latest + - ${CI_COMMIT_TAG:-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}} + username: + from_secret: DOCKER_USERNAME + password: + from_secret: DOCKER_PASSWORD build-backend: name: Build & Push Backend @@ -41,32 +41,32 @@ steps: password: from_secret: DOCKER_PASSWORD - # update-values-frontend: - # name: Update frontend tag in values.yaml - # image: alpine:3.19 - # when: - # branch: [ master, develop ] - # event: [ push ] - # path: - # include: [ frontend/** ] - # environment: - # GIT_USERNAME: - # from_secret: GIT_USERNAME - # GIT_TOKEN: - # from_secret: GIT_TOKEN - # commands: - # - apk add --no-cache git 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 - # - | - # TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}" - # echo "💡 Setting frontend tag to: $TAG" - # yq -i ".frontend.tag = \"$TAG\"" manifests/${CI_REPO_NAME}/values.yaml - # git add manifests/${CI_REPO_NAME}/values.yaml - # git commit -m "frontend: update tag to $TAG" || echo "No changes" - # git push origin HEAD + update-values-frontend: + name: Update frontend tag in values.yaml + image: alpine:3.19 + when: + branch: [ master, develop ] + event: [ push ] + path: + include: [ frontend/** ] + environment: + GIT_USERNAME: + from_secret: GIT_USERNAME + GIT_TOKEN: + from_secret: GIT_TOKEN + commands: + - apk add --no-cache git 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 + - | + TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}" + echo "💡 Setting frontend tag to: $TAG" + yq -i ".frontend.tag = \"$TAG\"" manifests/${CI_REPO_NAME}/values.yaml + git add manifests/${CI_REPO_NAME}/values.yaml + git commit -m "frontend: update tag to $TAG" || echo "No changes" + git push origin HEAD update-values-backend: name: Update backend tag in values.yaml diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..04c2d63 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,11 @@ +__pycache__ +*.pyc +*.pyo +.git +.gitignore +.env +.env.local +.DS_Store +.pytest_cache +venv +env diff --git a/backend/__pycache__/db_utils.cpython-313.pyc b/backend/__pycache__/db_utils.cpython-313.pyc index 35a823f..feab553 100644 Binary files a/backend/__pycache__/db_utils.cpython-313.pyc and b/backend/__pycache__/db_utils.cpython-313.pyc differ diff --git a/backend/__pycache__/main.cpython-313.pyc b/backend/__pycache__/main.cpython-313.pyc index 104f60b..5140ab0 100644 Binary files a/backend/__pycache__/main.cpython-313.pyc and b/backend/__pycache__/main.cpython-313.pyc differ diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..80d6370 --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,9 @@ +node_modules +npm-debug.log +dist +.git +.gitignore +README.md +.env +.env.local +.DS_Store diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..711caef --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,32 @@ +# Build stage +FROM node:20-alpine AS builder + +WORKDIR /app + +# Copy package files +COPY package.json package-lock.json* ./ + +# Install dependencies +RUN npm ci + +# Copy source code +COPY . . + +# Build the application +RUN npm run build + +# Production stage +FROM node:20-alpine + +WORKDIR /app + +# Install a simple HTTP server to serve the built app +RUN npm install -g serve + +# Copy built app from builder stage +COPY --from=builder /app/dist ./dist + +EXPOSE 3000 + +# Serve the built app +CMD ["serve", "-s", "dist", "-l", "3000"]