Add GitLab CI, Dockerfile, and demo-1
* Configured GitLab CI for Docker image builds and added a Dockerfile with the necessary setup for the main website and demo-1. * Updated URL and removed duplicate entry in `demos.ts` to resolve conflicts. * Integrated `.run` configuration for lawfirm-demo1 to streamline local development.
This commit is contained in:
10
.gitlab-ci-template.yml
Normal file
10
.gitlab-ci-template.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.docker-login:
|
||||||
|
before_script:
|
||||||
|
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
|
||||||
|
|
||||||
|
docker-build-template:
|
||||||
|
image: docker:20.10@sha256:2967f0819c84dd589ed0a023b9d25dcfe7a3c123d5bf784ffbb77edf55335f0c
|
||||||
|
extends: .docker-login
|
||||||
|
script:
|
||||||
|
- docker build --build-arg WORKDIR_PATH=$WORKDIR_PATH -t $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_REF_SLUG -f $DOCKERFILE_PATH .
|
||||||
|
- docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_REF_SLUG
|
||||||
28
.gitlab-ci.yml
Normal file
28
.gitlab-ci.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
image: docker:20.10
|
||||||
|
|
||||||
|
include:
|
||||||
|
- local: '.gitlab-ci-template.yml'
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- dockerize
|
||||||
|
|
||||||
|
variables:
|
||||||
|
CI_REGISTRY_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH
|
||||||
|
PROJECT_NAME: $CI_PROJECT_NAME
|
||||||
|
TAG: $CI_COMMIT_REF_SLUG
|
||||||
|
|
||||||
|
# Main Website
|
||||||
|
build_main_website:
|
||||||
|
stage: dockerize
|
||||||
|
extends: .docker-build-template
|
||||||
|
variables:
|
||||||
|
IMAGE_NAME: main-website
|
||||||
|
WORKDIR_PATH: ./main-website
|
||||||
|
|
||||||
|
# Demo 1
|
||||||
|
build_demo_1:
|
||||||
|
stage: dockerize
|
||||||
|
extends: .docker-build-template
|
||||||
|
variables:
|
||||||
|
IMAGE_NAME: ld1
|
||||||
|
WORKDIR_PATH: ./lawfirm-demos/demo-1
|
||||||
14
.run/lawfirm-demo1.run.xml
Normal file
14
.run/lawfirm-demo1.run.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="lawfirm-demo1" type="js.build_tools.npm">
|
||||||
|
<package-json value="$PROJECT_DIR$/lawfirm-demos/demo-1/package.json" />
|
||||||
|
<command value="run" />
|
||||||
|
<scripts>
|
||||||
|
<script value="dev" />
|
||||||
|
</scripts>
|
||||||
|
<node-interpreter value="project" />
|
||||||
|
<envs>
|
||||||
|
<env name="PORT" value="5101" />
|
||||||
|
</envs>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Use a lightweight Node.js 20 Alpine image (digest-pinned for reproducibility)
|
||||||
|
FROM node:20-alpine@sha256:9bef0ef1e268f60627da9ba7d7605e8831d5b56ad07487d24d1aa386336d1944
|
||||||
|
|
||||||
|
# Accept a build argument for the working directory
|
||||||
|
ARG WORKDIR_PATH
|
||||||
|
|
||||||
|
# Set the working directory inside the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy only the production-ready files built in CI
|
||||||
|
# These files must be passed as GitLab artifacts:
|
||||||
|
# - .next/ → built Next.js app
|
||||||
|
# - public/ → static assets
|
||||||
|
# - package.json → app manifest
|
||||||
|
# - package-lock.json → to lock dependencies for reproducibility
|
||||||
|
COPY ${WORKDIR_PATH}/.next .next
|
||||||
|
COPY ${WORKDIR_PATH}/public public
|
||||||
|
COPY ${WORKDIR_PATH}/package.json package.json
|
||||||
|
COPY ${WORKDIR_PATH}/package-lock.json package-lock.json
|
||||||
|
|
||||||
|
# Install only production dependencies to reduce image size
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
# Expose the port that Next.js serves on (default is 3000)
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start the Next.js app in production mode
|
||||||
|
CMD ["npm", "run", "start"]
|
||||||
@@ -14,7 +14,7 @@ export const demoCategories = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Anwaltskanzlei Demo 2',
|
name: 'Anwaltskanzlei Demo 2',
|
||||||
url: 'http://localhost:5102',
|
url: 'http://localhost:5101',
|
||||||
preview: '/previews/lawfirm-1.png',
|
preview: '/previews/lawfirm-1.png',
|
||||||
description: [
|
description: [
|
||||||
'Modernes Design',
|
'Modernes Design',
|
||||||
@@ -23,18 +23,6 @@ export const demoCategories = [
|
|||||||
'Optimiert für Rechtsanwälte 1',
|
'Optimiert für Rechtsanwälte 1',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Anwaltskanzlei Demo 2',
|
|
||||||
url: 'http://localhost:5102',
|
|
||||||
preview: '/previews/lawfirm-1.png',
|
|
||||||
description: [
|
|
||||||
'Modernes Design',
|
|
||||||
'Dunkles Layout',
|
|
||||||
'Optimiert für Rechtsanwälte',
|
|
||||||
'Optimiert für Rechtsanwälte 2',
|
|
||||||
'Optimiert für Rechtsanwälte 3',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user