Skip to content

Docker

Gitlab repository

git@<YOUR GITLABSERVER>:/docker/docusaurus.git

Dockerfile

FROM node:alpine

RUN mkdir -p /site/
WORKDIR /site/

RUN npx docusaurus-init
RUN rm -rfv /site/website/pages/*
WORKDIR /site/website/

.gitlab-ci.yml

---

image: docker:latest

services:
  - docker:dind

variables:
  IMAGE: <YOUR DOCKER-REGISTRY>/${CI_PROJECT_PATH}

build:
  script:
    - VERSION=$(docker run --rm node:9-stretch npm show docusaurus version)
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN <YOUR DOCKER-REGISTRY>
    - docker build --pull -t ${IMAGE}:${VERSION} -t ${IMAGE}:latest .
    - docker push ${IMAGE}:${VERSION}
    - docker push ${IMAGE}:latest

Last update: January 26, 2021

Comments