DEV Community

Cover image for Subindo imagens para Harbor
Mattheus Cassundé
Mattheus Cassundé

Posted on • Edited on

Subindo imagens para Harbor

Introdução

Harbor é uma ferramenta simples para armazenar suas imagens docker.

Em nosso exemplo vamos fazer a entrega de um site simples, onde os arquivos estão dentro da pasta /dist

Pré Requisitos

  1. Sua máquina deve ter o Docker instalado, aqui você pode ver como.

  2. Sua aplicação deve ter um Dockerfile com as configurações necessárias para realizar o build da sua imagem com sucesso.

Por exemplo:

FROM httpd:2.4

ENV IP_API=192.0.0.1

COPY ./dist/ /usr/local/apache2/htdocs/
Enter fullscreen mode Exit fullscreen mode

Criando sua imagem

  1. Dentro a pasta do site digite o seguinte comando
sudo docker build -t {nome-sua-app}:{versao} .
Enter fullscreen mode Exit fullscreen mode

por exemplo:

sudo docker build -t site-sample:0.0.1 .
Enter fullscreen mode Exit fullscreen mode

Criando tag

Precisamos criar tag para cada versão da nossa aplicação, podemos usar o seguinte comando:

sudo docker tag {nome-sua-app}:{versao} {url-registry}/{projeto}/{nome-sua-app}:{versao}
Enter fullscreen mode Exit fullscreen mode

por exemplo:

sudo docker tag site-sample:0.0.1 registry.inlinesoft.com.br/test/site-sample:0.0.1
Enter fullscreen mode Exit fullscreen mode

Push para repositório

Para enviar uma image para o repositório devemos executar o comando push seguindo o seguinte template:

sudo docker push {url-registry}/{projeto}/{nome-sua-app}:{versao}
Enter fullscreen mode Exit fullscreen mode

por exemplo:

sudo docker push site-sample:0.0.1 registry.inlinesoft.com.br/test/site-sample:0.0.1
Enter fullscreen mode Exit fullscreen mode

Se tiver dado tudo certo, ao acessar seu registry você verá sua imagem disponível.

Agora é só colocar para rodar no seu servidor.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay