feat(build): Migrate from static Nginx to Node.js server
This commit transitions the application from being served as a static site via Nginx to a full Node.js application, likely Next.js. The Dockerfile has been completely rewritten to use a multi-stage build process: - A `builder` stage installs dependencies and builds the application. - A lean `runner` stage copies only the necessary production artifacts and dependencies to run the application server. The `.drone.yml` configuration has been updated to align with this new build process and to trigger builds on the `develop` branch in addition to `main`.
This commit is contained in:
+7
-6
@@ -1,9 +1,9 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Landing
|
# web
|
||||||
################################################################################
|
################################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: (web landing) build form and push to artifactory
|
name: (landing) build form and push to artifactory
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: tag
|
- name: tag
|
||||||
@@ -19,11 +19,11 @@ steps:
|
|||||||
- echo "APP Version tags $APP_VERSION"
|
- echo "APP Version tags $APP_VERSION"
|
||||||
- echo -n "$APP_VERSION" >> .tags
|
- echo -n "$APP_VERSION" >> .tags
|
||||||
|
|
||||||
- name: build landing
|
- name: build landing
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
# build_args:
|
# build_args:
|
||||||
# - BUILD_APP=landing
|
# - BUILD_APP=scraper
|
||||||
username: cicd
|
username: cicd
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASSWORD
|
from_secret: REGISTRY_PASSWORD
|
||||||
@@ -36,5 +36,6 @@ node:
|
|||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
|
- develop
|
||||||
event:
|
event:
|
||||||
- custom
|
- custom
|
||||||
|
|||||||
+29
-4
@@ -1,7 +1,32 @@
|
|||||||
FROM nginx:alpine
|
FROM node:22.19.0 AS builder
|
||||||
|
|
||||||
COPY . /usr/share/nginx/html/
|
WORKDIR /app
|
||||||
|
# RUN apk add --no-cache libc6-compat
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
COPY package*.json ./
|
||||||
|
RUN npm i
|
||||||
|
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN docker build .
|
||||||
|
|
||||||
|
#---
|
||||||
|
|
||||||
|
FROM node:22.19.0 AS runner
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
COPY --from=builder /app/package*.json ./
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
||||||
|
|||||||
Reference in New Issue
Block a user