### Local Docker Image Build and Run Commands Source: https://context7.com/sourcecraft/template-docker-image.git/llms.txt These bash commands demonstrate how to manually build and run the Docker image locally. It includes building with a specific tag, running the container to see the output, and building with a timestamped tag similar to CI practices. ```bash # Сборка образа с тегом hello-world docker build . --file Dockerfile --tag hello-world:latest # Запуск контейнера docker run hello-world:latest # Вывод: Hello World!! # Сборка с временной меткой (как в CI) docker build . --file Dockerfile --tag dockerhub_account/hello-world:$(date +%s) ``` -------------------------------- ### SourceCraft CI/CD with Docker Hub Push Configuration Source: https://context7.com/sourcecraft/template-docker-image.git/llms.txt This YAML snippet extends the SourceCraft CI/CD configuration to include publishing the Docker image to Docker Hub. It adds a 'push-dockerhub' cube that logs in using provided secrets (USER and PAT) and then pushes the built image. ```yaml tasks: - name: build-task env: IMAGE_URI: dockerhub_account/hello-world cubes: - name: docker-build script: - docker build . --file Dockerfile --tag $IMAGE_URI:$(date +%s) - name: push-dockerhub env: USER: ${{ secrets.user }} PAT: ${{ secrets.PAT }} script: - echo $PAT | docker login --username $USER --password-stdin - docker push $IMAGE_URI ``` -------------------------------- ### Build Docker Image with Dockerfile Source: https://context7.com/sourcecraft/template-docker-image.git/llms.txt This Dockerfile defines a simple Docker image based on Alpine Linux. It uses the `CMD` instruction to print 'Hello World!!' when a container is run from this image. The base image is pulled from the Yandex Cloud mirror. ```dockerfile FROM cr.yandex/mirror/alpine CMD ["echo", "Hello World!!"] ``` -------------------------------- ### SourceCraft CI/CD Pipeline Configuration Source: https://context7.com/sourcecraft/template-docker-image.git/llms.txt This YAML configuration defines the SourceCraft CI/CD pipeline. It triggers on push to master/main branches and pull requests. The pipeline includes a build task that uses a Docker build cube to build the image with a dynamic tag. ```yaml on: push: - workflows: build-workflow filter: branches: ["master", "main"] pull_request: - workflows: build-workflow filter: source_branches: ["**", "!test**"] target_branches: "master" workflows: build-workflow: tasks: - build-task tasks: - name: build-task env: IMAGE_URI: dockerhub_account/hello-world cubes: - name: docker-build script: - docker build . --file Dockerfile --tag $IMAGE_URI:$(date +%s) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.