zoukankan      html  css  js  c++  java
  • [DevOps] Environment Variables with Travis

    After build sucess, we want to push the build docker image to dockerhub. For that we need to login dockerhub provide username and password.

    Of course, we don't want to public our password. They how can we do that.

    .travis.yml:

    language: node_js
    node_js:
      - 13
    
    services:
      - docker
    
    # Pre-testing installs
    install:
      - echo "nothing needs to be installed!"
    
    # Scripts to be run such as tests
    before_script:
      - echo "no tests"
    
    script:
      - docker --version # print the version for logging
      - docker build -t simple-node .
      - docker tag simple-node zhentian/simple-node:latest
    
    # Tasks to perform after the process is successful. Formatting the Docker username and password as below enables you to programmatically log in without having the password exposed in logs.
    after_success:
      - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
      - docker push zhentian/simple-node

    Basicly, we use:

    - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

    `$DOCKER_PASSWORD` was set as env variable in Travis:

    The output of password will be the input of `--password-stdin`.

  • 相关阅读:
    车辆年检、强险、车船税的关系
    .Net下几种ORM
    Windows 刷新图标命令
    VUE-CLI + AntV G6 兼容IE11
    CentOS 7 下安装 JIRA 8.7 和 Confluence 7.3
    .Net Core,VUE,VS Code,Sql Sugar,Element UI学习笔记
    Nginx 缓存代理
    java对象锁和类锁
    线程的生命周期
    数据库分库分表
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14608665.html
Copyright © 2011-2022 走看看