Code Monkey home page Code Monkey logo

circleci-playground's Introduction

circleci-playground

Repository for hands-on exploration and experimentation with CircleCI. Learn Continuous Integration (CI) workflows, test automation, and deployment strategies in a sandbox environment

The project is a simple application That responds Hello World, The secret env is $SECRET_KEY on hitting / endpoint on 8080. Where SECRET_KEY is an environment variable.

The circleci config will:

  • Run tests
  • Build the image
  • Push to dockerHub

CircleCi config

version: 2.1

jobs:
  build:
    docker:
      - image: cimg/go:1.21.8  # Using a CircleCI maintained Go image

    working_directory: ~/circleci-playground  # Set the working directory

    steps:
      - checkout # checks out the source code of the project into the working directory

      # Run Go tests
      - run:
          name: Run Go tests
          command: go test -cover ./...  

      # Use setup_remote_docker to set up a remote Docker environment
      - setup_remote_docker

      # Build Docker image (Make sure Dockerfile is in the root folder of the project)
      - run:
          name: Build Docker image
          command: docker build -t breeze5690/hello-world:latest . 

      # Login to Docker Hub using environment variables
      - run:
          name: Login to Docker Hub
          command: docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD

      # Push Docker image to Docker Hub
      - run:
          name: Push Docker image to Docker Hub
          command: docker push breeze5690/hello-world:latest

workflows:
  version: 2
  build:
    jobs:
      - build

circleci-playground's People

Contributors

aswinbennyofficial avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.