generated from nataliagranato/LINUXtips-PICK
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add Dockerfile for Alpine image with Nginx and index.html
- Loading branch information
1 parent
6afc97a
commit 223ec5c
Showing
10 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Etapa 1: Construção | ||
FROM alpine:3.18 AS builder | ||
|
||
RUN apk update && apk add --no-cache nginx | ||
|
||
COPY index.html /var/www/html/ | ||
|
||
# Etapa 2: Imagem final | ||
FROM alpine:3.18 | ||
|
||
COPY --from=builder /etc/nginx /etc/nginx | ||
COPY --from=builder /usr/sbin/nginx /usr/sbin/nginx | ||
COPY --from=builder /var/www/html /var/www/html | ||
|
||
EXPOSE 80 | ||
|
||
WORKDIR /var/www/html/ | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
|
||
ENV APP_VERSION 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Programa Intensivo em Containers e Kubernetes da LINUXtips</title> | ||
</head> | ||
|
||
<body> | ||
<h1>Programa Intensivo em Containers e Kubernetes da LINUXtips!</h1> | ||
|
||
<p>Com o Programa Intensivo em Containers e Kubernetes da LINUXtips, voce tera acesso a uma formacao completa e | ||
totalmente pratica, que nao apenas transfere conhecimento, mas tambem prepara voce para enfrentar desafios reais | ||
no mundo real.</p> | ||
|
||
|
||
<p>Confira o meu repositorio no GitHub: <a href="https://github.com/Tech-Preta/pick" | ||
target="_blank">https://github.com/Tech-Preta/pick</a></p> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM cgr.dev/chainguard/python:latest-dev as builder | ||
|
||
ENV LANG=C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV PATH="/linky/venv/bin:$PATH" | ||
|
||
WORKDIR /linky | ||
|
||
RUN python -m venv /linky/venv | ||
COPY requirements.txt . | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
FROM cgr.dev/chainguard/python:latest | ||
|
||
WORKDIR /linky | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
ENV PATH="/venv/bin:$PATH" | ||
|
||
COPY linky.py linky.png ./ | ||
COPY --from=builder /linky/venv /venv | ||
|
||
ENTRYPOINT [ "python", "/linky/linky.py" ] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'''import climage module to display images on terminal''' | ||
from climage import convert | ||
|
||
|
||
def main(): | ||
'''Take in PNG and output as ANSI to terminal''' | ||
output = convert('linky.png', is_unicode=True) | ||
print(output) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
setuptools==68.2.2 | ||
climage==0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
# Etapa 1: Construção | ||
FROM ubuntu:22.04 AS builder | ||
# A instrução FROM especifica a imagem base para a etapa de construção. | ||
# Neste caso, utiliza a imagem do Ubuntu 22.04 como base. | ||
|
||
# Instala o servidor web Nginx e outras dependências necessárias | ||
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/* | ||
# Este comando Dockerfile instala o servidor web Nginx no contêiner. | ||
# Ele atualiza o sistema operacional e, em seguida, usa o comando apt-get para instalar o pacote nginx. | ||
# O parâmetro "-y" é usado para confirmar automaticamente todas as perguntas de instalação. | ||
# Por fim, o comando "rm -rf /var/lib/apt/lists/*" remove os arquivos de lista de pacotes desnecessários para economizar espaço em disco. | ||
|
||
# Copia o arquivo index.html para o diretório /var/www/html/ dentro do container | ||
COPY index.html /var/www/html/ | ||
|
||
# Etapa 2: Imagem final | ||
FROM ubuntu:22.04 | ||
# A instrução FROM especifica a imagem base para a imagem final. | ||
# Neste caso, utiliza a imagem do Ubuntu 22.04 como base. | ||
|
||
# Copia o Nginx instalado e o arquivo index.html da etapa de construção para a imagem final | ||
COPY --from=builder /etc/nginx /etc/nginx | ||
COPY --from=builder /usr/sbin/nginx /usr/sbin/nginx | ||
COPY --from=builder /var/www/html /var/www/html | ||
|
||
# Expõe a porta 80 para tráfego HTTP. | ||
EXPOSE 80 | ||
|
||
# Define o diretório de trabalho como /var/www/html/ dentro do container | ||
WORKDIR /var/www/html/ | ||
|
||
# O comando CMD especifica o comando a ser executado quando o contêiner é iniciado. | ||
# Neste caso, inicia o servidor Nginx com a opção "daemon off;", que mantém o processo em execução em primeiro plano. | ||
CMD ["nginx", "-g", "daemon off;"] | ||
|
||
# Define a variável de ambiente APP_VERSION com o valor 1.0.0. | ||
ENV APP_VERSION 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Programa Intensivo em Containers e Kubernetes da LINUXtips</title> | ||
</head> | ||
|
||
<body> | ||
<h1>Programa Intensivo em Containers e Kubernetes da LINUXtips!</h1> | ||
|
||
<p>Com o Programa Intensivo em Containers e Kubernetes da LINUXtips, voce tera acesso a uma formacao completa e | ||
totalmente pratica, que nao apenas transfere conhecimento, mas tambem prepara voce para enfrentar desafios reais | ||
no mundo real.</p> | ||
|
||
|
||
<p>Confira o meu repositorio no GitHub: <a href="https://github.com/Tech-Preta/pick" | ||
target="_blank">https://github.com/Tech-Preta/pick</a></p> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && apt-get install nginx -y && rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 80 | ||
|
||
COPY index.html /var/www/html/ | ||
|
||
WORKDIR /var/www/html/ | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
|
||
ENV APP_VERSION 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Programa Intensivo em Containers e Kubernetes da LINUXtips</title> | ||
</head> | ||
|
||
<body> | ||
<h1>Programa Intensivo em Containers e Kubernetes da LINUXtips!</h1> | ||
|
||
<p>Com o Programa Intensivo em Containers e Kubernetes da LINUXtips, voce tera acesso a uma formacao completa e | ||
totalmente pratica, que nao apenas transfere conhecimento, mas tambem prepara voce para enfrentar desafios reais | ||
no mundo real.</p> | ||
|
||
|
||
<p>Confira o meu repositorio no GitHub: <a href="https://github.com/Tech-Preta/pick" | ||
target="_blank">https://github.com/Tech-Preta/pick</a></p> | ||
</body> | ||
|
||
</html> |