Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit c486c57

Browse files
committed
Adding CI
1 parent f92626f commit c486c57

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.gitlab-ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
variables:
2+
REGISTRY_URL: "registry.storefrontcloud.io"
3+
REGISTRY_IMAGE: "registry.storefrontcloud.io/test/vue-storefront-api"
4+
5+
stages:
6+
- build
7+
- deploy
8+
9+
build:
10+
stage: build
11+
image:
12+
name: gcr.io/kaniko-project/executor:debug
13+
entrypoint: [""]
14+
script:
15+
- cat config/local.json
16+
- echo "{\"auths\":{\"$REGISTRY_URL\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
17+
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/dev/docker/Dockerfile --destination $REGISTRY_IMAGE:\${CI_COMMIT_SHA:0:8}
18+
only:
19+
- develop
20+
- master
21+
22+
deploy-to-prod:
23+
stage: deploy
24+
image: alpine
25+
script:
26+
- apk add --no-cache curl
27+
- >
28+
curl -H "Content-Type: application/json" -X POST -d "{\"code\":\"test\", \"apiContainerVersion\":\"\${CI_COMMIT_SHA:0:8}\"}" http://10.29.1.1:4000/instances
29+
environment:
30+
name: staging
31+
url: https://test.storefrontcloud.io/
32+
only:
33+
- master

dev/docker/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:8-alpine
2+
3+
ENV BIND_HOST=0.0.0.0 ELASTICSEARCH_HOST=elasticsearch ELASTICSEARCH_PORT=9200 REDIS_HOST=redis REDIS_PORT=6379 REDIS_DB=0 PM2_ARGS=--no-daemon VS_ENV=prod
4+
5+
WORKDIR /var/www
6+
7+
COPY . .
8+
9+
RUN apk add --no-cache git \
10+
&& yarn install
11+
12+
COPY dev/docker/vue-storefront-api.sh /usr/local/bin/
13+
14+
ENTRYPOINT ["vue-storefront-api.sh"]

dev/docker/vue-storefront-api.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$VS_ENV" = 'dev' ]; then
5+
yarn dev
6+
else
7+
yarn start
8+
fi

0 commit comments

Comments
 (0)