diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1b26793..f849052c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: node:lts-jessie stages: - test + - build audit: stage: test @@ -30,4 +31,20 @@ lint-client: - eslint . only: - merge_requests - - master \ No newline at end of file + - master + +build-image: + stage: build + image: docker:stable + services: + - docker:dind + before_script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + script: + - docker build -t $IMAGE_TAG . + - docker push $IMAGE_TAG + only: + - master + - tags \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..04548683 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Base image on Node.js 10.x LTS (dubnium) +FROM node:10 + +# Create app directory +WORKDIR /usr/src/isleward + +# Bundle app source +COPY . . + +# Change directory to src/server/ +WORKDIR /usr/src/isleward/src/server/ + +# Install npm modules specified in package.json +RUN npm install --only-production + +# Expose container's port 4000 +EXPOSE 4000 + +# Launch Isleward server +CMD ["node", "--expose-gc", "index.js"] \ No newline at end of file