Update frontend Dockerfile
This commit is contained in:
parent
3afc7d2750
commit
30986fdf40
@ -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
|
||||
|
||||
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