Implement CI/CD
This commit is contained in:
parent
edf132c168
commit
0afc9c27af
57
.gitlab-ci.yml
Normal file
57
.gitlab-ci.yml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
stages:
|
||||||
|
- "Install Dependencies"
|
||||||
|
- "Lint Code"
|
||||||
|
- "Build Docker Image"
|
||||||
|
- "Publish Docker Image"
|
||||||
|
|
||||||
|
"Install node_modules":
|
||||||
|
image: node:16
|
||||||
|
stage: "Install Dependencies"
|
||||||
|
script:
|
||||||
|
- yarn --frozen-lockfile
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
|
||||||
|
"Lint JS":
|
||||||
|
image: node:16
|
||||||
|
stage: "Lint Code"
|
||||||
|
dependencies:
|
||||||
|
- "Install node_modules"
|
||||||
|
script:
|
||||||
|
- yarn lint --no-fix
|
||||||
|
|
||||||
|
"Build docker image":
|
||||||
|
image: docker:stable
|
||||||
|
stage: "Build Docker Image"
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- hawkeye
|
||||||
|
dependencies:
|
||||||
|
- "Install node_modules"
|
||||||
|
- "Lint JS"
|
||||||
|
script:
|
||||||
|
# Add make support
|
||||||
|
- 'apk add --no-cache make'
|
||||||
|
# Build the image
|
||||||
|
- 'make build-container DOCKER_REPOSITORY=$REGISTRY_BASE_URL/$DOCKER_IMAGE_NAME DOCKER_TAG=$CI_COMMIT_SHA'
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
|
||||||
|
|
||||||
|
"Publish Docker Image":
|
||||||
|
image: docker:stable
|
||||||
|
stage: "Publish Docker Image"
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- hawkeye
|
||||||
|
dependencies:
|
||||||
|
- "Build docker image"
|
||||||
|
script:
|
||||||
|
# Log in to the registry
|
||||||
|
- 'docker login -u=$REGISTRY_USER -p=$REGISTRY_PASSWORD $REGISTRY_BASE_URL'
|
||||||
|
# Push the registry images
|
||||||
|
- 'docker image push $REGISTRY_BASE_URL/$DOCKER_IMAGE_NAME:$CI_COMMIT_SHA'
|
||||||
|
# Clean local image
|
||||||
|
- 'docker image rm $REGISTRY_BASE_URL/$DOCKER_IMAGE_NAME:$CI_COMMIT_SHA'
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
|
||||||
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
DOCKER_REPOSITORY := daniel-website/nginx
|
DOCKER_REPOSITORY?="daniel-website/nginx"
|
||||||
DOCKER_TAG?="dev"
|
DOCKER_TAG?="dev"
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|||||||
@ -5,7 +5,7 @@ WORKDIR /code
|
|||||||
|
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
RUN yarn
|
RUN yarn --frozen-lockfile
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM nginx:1.22.0-alpine
|
FROM nginx:1.22.0-alpine
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
"id": 1,
|
||||||
"title": "Seconds since last pacman sync",
|
"title": "Seconds since last pacman sync",
|
||||||
"slug": "seconds-since-last-pacman-sync",
|
"slug": "seconds-since-last-pacman-sync",
|
||||||
"timeAdded": 1652993100,
|
"timeAdded": 1652993100,
|
||||||
|
|||||||
@ -2276,9 +2276,9 @@ caniuse-api@^3.0.0:
|
|||||||
lodash.uniq "^4.5.0"
|
lodash.uniq "^4.5.0"
|
||||||
|
|
||||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001335:
|
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001335:
|
||||||
version "1.0.30001343"
|
version "1.0.30001344"
|
||||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001343.tgz"
|
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001344.tgz"
|
||||||
integrity sha512-8KeCrAtPMabo/XW14B+R9sZYoClx1n0b+WYgwDKZPtWR3TcdvWzdSy7mPyFEmR5WU1St9v1PW6sdO5dkFOEzfA==
|
integrity sha512-0ZFjnlCaXNOAYcV7i+TtdKBp0L/3XEU2MF/x6Du1lrh+SRX4IfzIVL4HNJg5pB2PmFb8rszIGyOvsZnqqRoc2g==
|
||||||
|
|
||||||
case-sensitive-paths-webpack-plugin@^2.3.0:
|
case-sensitive-paths-webpack-plugin@^2.3.0:
|
||||||
version "2.4.0"
|
version "2.4.0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user