Update frontend Dockerfile
This commit is contained in:
parent
3afc7d2750
commit
30986fdf40
@ -1,24 +1,24 @@
|
|||||||
steps:
|
steps:
|
||||||
# build-frontend:
|
build-frontend:
|
||||||
# name: Build & Push Frontend
|
name: Build & Push Frontend
|
||||||
# image: woodpeckerci/plugin-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
# when:
|
when:
|
||||||
# branch: [ master, develop ]
|
branch: [ master, develop ]
|
||||||
# event: [ push, pull_request, tag ]
|
event: [ push, pull_request, tag ]
|
||||||
# path:
|
path:
|
||||||
# include: [ frontend/** ]
|
include: [ frontend/** ]
|
||||||
# settings:
|
settings:
|
||||||
# registry: harbor.dvirlabs.com
|
registry: harbor.dvirlabs.com
|
||||||
# repo: my-apps/${CI_REPO_NAME}-frontend
|
repo: my-apps/${CI_REPO_NAME}-frontend
|
||||||
# dockerfile: frontend/Dockerfile
|
dockerfile: frontend/Dockerfile
|
||||||
# context: frontend
|
context: frontend
|
||||||
# tags:
|
tags:
|
||||||
# - latest
|
- latest
|
||||||
# - ${CI_COMMIT_TAG:-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}}
|
- ${CI_COMMIT_TAG:-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}}
|
||||||
# username:
|
username:
|
||||||
# from_secret: DOCKER_USERNAME
|
from_secret: DOCKER_USERNAME
|
||||||
# password:
|
password:
|
||||||
# from_secret: DOCKER_PASSWORD
|
from_secret: DOCKER_PASSWORD
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
name: Build & Push Backend
|
name: Build & Push Backend
|
||||||
@ -41,32 +41,32 @@ steps:
|
|||||||
password:
|
password:
|
||||||
from_secret: DOCKER_PASSWORD
|
from_secret: DOCKER_PASSWORD
|
||||||
|
|
||||||
# update-values-frontend:
|
update-values-frontend:
|
||||||
# name: Update frontend tag in values.yaml
|
name: Update frontend tag in values.yaml
|
||||||
# image: alpine:3.19
|
image: alpine:3.19
|
||||||
# when:
|
when:
|
||||||
# branch: [ master, develop ]
|
branch: [ master, develop ]
|
||||||
# event: [ push ]
|
event: [ push ]
|
||||||
# path:
|
path:
|
||||||
# include: [ frontend/** ]
|
include: [ frontend/** ]
|
||||||
# environment:
|
environment:
|
||||||
# GIT_USERNAME:
|
GIT_USERNAME:
|
||||||
# from_secret: GIT_USERNAME
|
from_secret: GIT_USERNAME
|
||||||
# GIT_TOKEN:
|
GIT_TOKEN:
|
||||||
# from_secret: GIT_TOKEN
|
from_secret: GIT_TOKEN
|
||||||
# commands:
|
commands:
|
||||||
# - apk add --no-cache git yq
|
- apk add --no-cache git yq
|
||||||
# - git config --global user.name "woodpecker-bot"
|
- git config --global user.name "woodpecker-bot"
|
||||||
# - git config --global user.email "ci@dvirlabs.com"
|
- git config --global user.email "ci@dvirlabs.com"
|
||||||
# - git clone "https://$${GIT_USERNAME}:$${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git"
|
- git clone "https://$${GIT_USERNAME}:$${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/my-apps.git"
|
||||||
# - cd my-apps
|
- cd my-apps
|
||||||
# - |
|
- |
|
||||||
# TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
|
TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
|
||||||
# echo "💡 Setting frontend tag to: $TAG"
|
echo "💡 Setting frontend tag to: $TAG"
|
||||||
# yq -i ".frontend.tag = \"$TAG\"" manifests/${CI_REPO_NAME}/values.yaml
|
yq -i ".frontend.tag = \"$TAG\"" manifests/${CI_REPO_NAME}/values.yaml
|
||||||
# git add 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 commit -m "frontend: update tag to $TAG" || echo "No changes"
|
||||||
# git push origin HEAD
|
git push origin HEAD
|
||||||
|
|
||||||
update-values-backend:
|
update-values-backend:
|
||||||
name: Update backend tag in values.yaml
|
name: Update backend tag in values.yaml
|
||||||
|
|||||||
11
backend/.dockerignore
Normal file
11
backend/.dockerignore
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.DS_Store
|
||||||
|
.pytest_cache
|
||||||
|
venv
|
||||||
|
env
|
||||||
Binary file not shown.
Binary file not shown.
9
frontend/.dockerignore
Normal file
9
frontend/.dockerignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.DS_Store
|
||||||
32
frontend/Dockerfile
Normal file
32
frontend/Dockerfile
Normal file
@ -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"]
|
||||||
Loading…
x
Reference in New Issue
Block a user