Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
metagrid-go
metagrid-vue
Commits
9bdfbda2
Commit
9bdfbda2
authored
Oct 23, 2020
by
Tobinsk
Browse files
Add gitlab-ci and dockerfile to main branch
parent
6fae8b92
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
9bdfbda2
image
:
docker:19
variables
:
DOCKER_DRIVER
:
overlay2
DOCKER_TLS_CERTDIR
:
"
"
services
:
-
docker:dind
stages
:
-
build
-
push
# template for docker login
.before_script_template
:
&docker-login
before_script
:
-
echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
# build and push image
build-docker
:
<<
:
*docker-login
stage
:
build
script
:
-
docker pull $CI_REGISTRY_IMAGE:latest ||
true
-
docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
-
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
push-latest
:
<<
:
*docker-login
stage
:
push
variables
:
# we don't need git
GIT_STRATEGY
:
none
script
:
# reuse previously pushed image
-
docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
-
docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
-
docker push $CI_REGISTRY_IMAGE:latest
only
:
-
master
push-tag
:
<<
:
*docker-login
stage
:
push
variables
:
GIT_STRATEGY
:
none
script
:
-
docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
-
docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
-
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
only
:
-
tags
Dockerfile
0 → 100644
View file @
9bdfbda2
# build stage
FROM
node:lts-alpine as build-stage
WORKDIR
/app
COPY
package*.json ./
COPY
yarn.lock ./
RUN
yarn
COPY
. .
RUN
yarn run build
# production stage
FROM
nginx:stable-alpine as production-stage
COPY
--from=build-stage /app/dist /usr/share/nginx/html
COPY
nginx.conf /etc/nginx/nginx.conf
EXPOSE
80
CMD
["nginx", "-g", "daemon off;"]
nginx.conf
0 → 100644
View file @
9bdfbda2
user
nginx
;
worker_processes
1
;
error_log
/var/log/nginx/error.log
warn
;
pid
/var/run/nginx.pid
;
events
{
worker_connections
1024
;
}
http
{
include
/etc/nginx/mime.types
;
default_type
application/octet-stream
;
log_format
main
'
$remote_addr
-
$remote_user
[
$time_local
]
"
$request
"
'
'
$status
$body_bytes_sent
"
$http_referer
"
'
'"
$http_user_agent
"
"
$http_x_forwarded_for
"'
;
access_log
/var/log/nginx/access.log
main
;
sendfile
on
;
keepalive_timeout
65
;
server
{
listen
80
;
server_name
localhost
;
location
/
{
root
/usr/share/nginx/html
;
index
index.html
;
try_files
$uri
$uri
/
/index.html
;
}
error_page
500
502
503
504
/50x.html
;
location
=
/50x.html
{
root
/usr/share/nginx/html
;
}
}
}
yarn.lock
View file @
9bdfbda2
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment