Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend V2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Frontend V2
Commits
b39136b6
Commit
b39136b6
authored
1 year ago
by
Alen Zubic
Committed by
Scott
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: Docker multi-stage build and CI/CD push
parent
a833b946
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+9
-124
9 additions, 124 deletions
.gitlab-ci.yml
Dockerfile
+13
-7
13 additions, 7 deletions
Dockerfile
with
22 additions
and
131 deletions
.gitlab-ci.yml
+
9
−
124
View file @
b39136b6
stages
:
-
prepare
-
test
-
build
-
dockerize
-
deploy
default
:
image
:
nikolaik/python-nodejs:python3.11-nodejs19-alpine
cache
:
&cache
key
:
files
:
-
pnpm-lock.yaml
paths
:
-
.pnpm-store
-
./node_modules/
-
./apps/web/node_modules/
-
./libs/shared/node_modules/
policy
:
pull
before_script
:
-
npm i -g pnpm
-
pnpm config set store-dir .pnpm-store
-
apk add --no-cache --virtual .build-deps build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev
-
apk add --no-cache --virtual .runtime-deps cairo jpeg pango giflib
install:js
:
stage
:
prepare
interruptible
:
true
cache
:
<<
:
*cache
policy
:
push
script
:
-
pnpm install
# only:
# changes:
# - pnpm-lock.yaml
# - .gitlab-ci.yml
# - apps/**/*
# - libs/**/*
# refs:
# - main
# - merge_requests
.distributed
:
interruptible
:
true
cache
:
<<
:
*cache
before_script
:
-
npm i -g pnpm
-
apk add --update git
artifacts
:
paths
:
-
.pnpm-store
rules
:
# - if: $CI_COMMIT_BRANCH == "main"
# - if: $CI_COMMIT_BRANCH == "merge_requests"
-
changes
:
-
apps/**/*
-
libs/**/*
-
.gitlab-ci.yml
lint
:
stage
:
test
extends
:
.distributed
script
:
-
pnpm lint
test
:
stage
:
test
extends
:
.distributed
script
:
-
pnpm test
build-prod
:
stage
:
build
extends
:
.distributed
rules
:
# - if: $CI_COMMIT_BRANCH == "main"
-
changes
:
-
apps/**/*
-
libs/**/*
-
.gitlab-ci.yml
artifacts
:
paths
:
-
.pnpm-store
-
dist/apps/web
script
:
-
pnpm build
build-docker
:
image
:
docker:latest
services
:
-
name
:
docker:dind
alias
:
dockerdaemon
before_script
:
-
'
'
stage
:
dockerize
tags
:
-
docker
# only:
# - main
script
:
-
echo "$CI_REGISTRY_PASSWORD" | docker login https://$CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
-
cd ./apps/web
-
docker build --progress plain -t $CI_REGISTRY/graphpolaris/frontend:latest .
-
docker push $CI_REGISTRY/graphpolaris/frontend:latest
dependencies
:
-
build-prod
variables
:
# Tell docker CLI how to talk to Docker daemon.
DOCKER_HOST
:
tcp://dockerdaemon:2375/
# Use the overlayfs driver for improved performance.
DOCKER_DRIVER
:
overlay2
# Disable TLS since we're running inside local network.
DOCKER_TLS_CERTDIR
:
"
"
# deploy:
# stage: deploy
# script:
# - ./deploy.sh
# # only:
# # - main
# environment: production
variables
:
CONTAINER_IMAGE
:
"
graphpolaris/frontend"
IMAGE_TAG_HELM_FILE
:
"
helm/staging/graphpolaris-frontend/values.yaml"
IMAGE_TAG_HELM_FILE_VARIABLE
:
"
image.tag"
include
:
-
project
:
'
graphpolaris/pipelines'
ref
:
main
file
:
'
docker-build-push.yml'
This diff is collapsed.
Click to expand it.
Dockerfile
+
13
−
7
View file @
b39136b6
# Prepare nginx
FROM
nginx:1.19-alpine
FROM
node:lts-slim
AS
base
ENV
PNPM_HOME="/pnpm"
ENV
PATH="$PNPM_HOME:$PATH"
RUN
corepack
enable
COPY
. /app
WORKDIR
/app
COPY
./apps/web/dist /usr/share/nginx/html
FROM
base
AS
build
RUN
pnpm
install
--frozen-lockfile
# Fixes: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
ENV
NODE_OPTIONS="--max-old-space-size=4096"
RUN
pnpm run build
RUN
rm
/etc/nginx/conf.d/default.conf
COPY
nginx/nginx.conf /etc/nginx/conf.d
# Fire up nginx
FROM
nginx:1.25-alpine
COPY
--from=build /app/apps/web/dist /usr/share/nginx/html
COPY
./nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE
80
CMD
["nginx", "-g", "daemon off;"]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment