...
 
Commits (2)
include: 'https://gitlab.com/hyper-expanse/open-source/configuration-packages/gitlab-config/raw/master/src/gitlab-ci-node-lib.template.yml'
.docker_common: &docker_common
image: docker:latest@sha256:201c31cae6daa97001fe9c0cd2e2d3a157ca6447aaa74b070189790445627511
services:
- docker:dind@sha256:cda6ed53224efab2c1c461dbb019108b93d03ac741066b0958c60682e0aa4215
before_script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
docker_test:
<<: [*docker_common]
script:
- docker build --pull --tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} .
- echo "Do some tests here"
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
stage: test
# Use Alpine Linux as our base image so that we minimize the overall size our final container, and minimize the surface area of packages that could be out of date.
FROM node:10.13.0-alpine
# Container metadata describing the image, where it's configuration is housed, and its maintainer.
LABEL description="Docker image for executing `semantic-release-github`."
LABEL homepage="https://gitlab.com/hyper-expanse/open-source/semantic-release-github"
LABEL maintainer="Hutson Betts <hutson@hyper-expanse.net>"
LABEL repository="https://gitlab.com/hyper-expanse/open-source/semantic-release-github.git"
# The Alpine base image does not have a standard collection of CA root certificates installed. As a result all HTTPS requests will fail with 'x509: failed to load system roots and no root provided'.
# We install the `ca-certificates` package to have access to a standard collection of CA root certificates for HTTPS operations that the `semantic-release-github` tool executes to interact with the GitHub API.
# We install the `git` package for Git operations that the `semantic-release-github` tool executes.
RUN apk update && \
apk add --no-cache --progress ca-certificates && \
apk add --no-cache --progress git
# Copy only those files required in production.
COPY package.json package.json
COPY yarn.lock yarn.lock
COPY src/ src/
# Install only production dependencies for the `semantic-release-github` package.
# We create a symbolic link in the global binary directory that points to the `semantic-release-github` executable.
RUN yarn install --production && \
yarn link
# Command to execute within the Docker container when executed by `docker run`, and unless overriden by `--entrypoint`.
# This command causes the container to automatically run the release tool, `semantic-release-github`, within the working directory.
# We assume the contents of a project, including it's `.git` directory, has been mounted inside of the container at the `WORKDIR` specified above.
ENTRYPOINT ["semantic-release-github"]