Task Overview

This tutorial demonstrates how you can easily start using Werf with Dockerfile. We will build the application image and publish it to the local Docker registry. For example, we choose simple project — Linux Tweet App.

Requirements

Select Werf version

This command should be run prior running any Werf command in your shell session:

source <(multiwerf use 1.0 beta)

Step 1: Add a Werf configuration

Add a special file called werf.yaml to the source code and define application image based on project Dockerfile.

  1. Clone the Linux Tweet App repository to get the source code:

     git clone https://github.com/dockersamples/linux_tweet_app.git
     cd linux_tweet_app
    
  2. In the project root directory create a werf.yaml with the following content:

    project: g-started
    configVersion: 1
    ---
    image: ~
    dockerfile: Dockerfile
    

Step 2: Build and Check the Application

  1. Build an image (execute in the project root directory):

    werf build --stages-storage :local
    
  2. Run a container from the image:

    werf run --stages-storage :local --docker-options="-d -p 80:80"
    
  3. Check that the application runs and responds by opening http://localhost:80 in your browser or executing:

    curl localhost:80
    

Step 3: Publish built image to Docker registry

  1. Run local Docker registry:

     docker run -d -p 5000:5000 --restart=always --name registry registry:2
    
  2. Publish image using custom tagging strategy with docker tag v0.1.0:

     werf publish --stages-storage :local --images-repo localhost:5000/g-started --tag-custom v0.1.0
    

What’s next?

Firstly, you can plunge into the relevant documentation:

Or go further: