Sign inSign up

kirbownz/node12-rsync-python-ssh

By kirbownz

Updated almost 5 years ago

Node 12 container with rsync, python and ssh support

Image
0

2.5K

kirbownz/node12-rsync-python-ssh repository overview

docker-node-12-rsync-python-ssh

Node 12 container with rsync, python and ssh support

Example how to use this image in GitLab CI/CD

  1. Create file .gitlab-ci.yml, e.g.:
image: kirbownz/node12-rsync-python-ssh

###### STAGES #################################################################
stages:
  - install
  - test
  - build
  - deploy

###### TEMPLATES ##############################################################
.general: &general
  variables:
    GIT_STRATEGY: fetch

variables:
  # Docker in Docker variables
  DOCKER_HOST: "tcp://docker:2375"

###### JOBS ###################################################################
install:
  <<: *general
  stage: install
  artifacts:
    paths:
      - node_modules
    expire_in: 1 day
  script:
    - rm yarn.lock
    - yarn

test:
  <<: *general
  stage: test
  dependencies:
    - install
  script:
    - yarn test

build:
  <<: *general
  stage: build
  dependencies:
    - install
  artifacts:
    paths:
      - build
    expire_in: 1 week
  script:
    - yarn build

deployment:
  <<: *general
  stage: deploy
  dependencies:
    - build
  script:
    - mkdir -p ~/.ssh
    - echo "${ssh_key}" > ~/.ssh/id_rsa
    - chmod 700 ~/.ssh
    - chmod 600 ~/.ssh/id_rsa
    - echo "${gitconfig}" > ~/.gitconfig
    - ssh-keyscan -t rsa ${demo_host} >> ~/.ssh/known_hosts
    - rsync build/ ${demo_user}@${demo_host}:${demo_path} --delete-after -r -v
  1. Add the variables above in GitLab -> Project -> Settings -> CI / CD -> Variables:
TypeKeyValueProtectedMaskedScope
Variabledemo_hostexample.com--All environments
Variabledemo_path~/project/dist/--All environments
Variabledemo_useruser--All environments
Variablegitconfig[user]
name = Firstname Lastname
email = [email protected]
--All environments
Variablessh_key-----BEGIN RSA...--All environments

Tag summary

Content type

Image

Digest

Size

50.9 MB

Last updated

almost 5 years ago

docker pull kirbownz/node12-rsync-python-ssh