For aiur
parent
4fd9e84260
commit
cb4d4973ea
32
README.md
32
README.md
|
|
@ -1,2 +1,32 @@
|
||||||
# taller-docker
|
# Taller Docker iLab
|
||||||
|
|
||||||
|
Este repositorio tiene las diapositivas y archivos de trabajo del taller. Estará disponible solo durante el taller y luego se volverá privado.
|
||||||
|
|
||||||
|
## Directorio diapos
|
||||||
|
|
||||||
|
Contiene un PDF con las diapositivas del taller
|
||||||
|
|
||||||
|
## Directorio code
|
||||||
|
|
||||||
|
Contiene los archivos con actividades:
|
||||||
|
|
||||||
|
### 1.ciclo
|
||||||
|
|
||||||
|
`Dockerfile` basico para crear un contenedor Python 3
|
||||||
|
|
||||||
|
### 2.flask
|
||||||
|
|
||||||
|
`Dockerfile` intermedio. Inicia una imagen de ubuntu:20.04 y descarga programas y bibliotecas para que el sitio web opere normalmente.
|
||||||
|
|
||||||
|
### 3.wordpress
|
||||||
|
|
||||||
|
`docker-compose.yml` que contiene la información de los contenedores necesarios para operar wordpress
|
||||||
|
|
||||||
|
### 4.chat
|
||||||
|
|
||||||
|
`docker-compose.yml` que contiene la información de los contenedores necesarios para crear una aplicación de mensajeria privada usando Rocker-chat
|
||||||
|
|
||||||
|
### 5.plex
|
||||||
|
|
||||||
|
`docker-compose.yml` que contiene la información para iniciar un servidor de multimedia usando Plex
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
FROM python:3
|
||||||
|
|
||||||
|
COPY myapp.py .
|
||||||
|
|
||||||
|
ENTRYPOINT ["python"]
|
||||||
|
|
||||||
|
CMD ["myapp.py"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(10):
|
||||||
|
print("Nada que hacer. Hibernando 1 segundo : {}".format(i))
|
||||||
|
time.sleep(1)
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,28 @@
|
||||||
|
FROM ubuntu:20.04
|
||||||
|
#FROM debian:buster-slim
|
||||||
|
#FROM python:3
|
||||||
|
|
||||||
|
RUN apt-get update -y
|
||||||
|
RUN apt-get install -y python3-pip python3-dev build-essential git
|
||||||
|
|
||||||
|
|
||||||
|
# Crea una cuenta de usuario y grupo para ejecutar el servidor web
|
||||||
|
RUN groupadd app && useradd -g app app
|
||||||
|
|
||||||
|
# Descarga/clona el la última versión del codigo del sitio desde el repositorio al directorio de servicio
|
||||||
|
RUN git clone https://dev.ilab.cl/public/pythonweb.git /srv
|
||||||
|
|
||||||
|
|
||||||
|
# Inicializa el codifo (descarga las bibliotecas)
|
||||||
|
WORKDIR /srv/web-interface
|
||||||
|
RUN pip3 install setuptools gunicorn
|
||||||
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Cambia los permisos del directorio de servicio y abre el puerto del firewall
|
||||||
|
RUN chown -R app:app /srv
|
||||||
|
USER app
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# Indica el programa y los parametros que deben ejecutarse al ejecutar "ejecutar" el contenedor
|
||||||
|
ENTRYPOINT ["gunicorn"]
|
||||||
|
CMD ["-b", "0.0.0.0:8000", "wsgi:app"]
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
version: "2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: somewordpress
|
||||||
|
MYSQL_DATABASE: wordpress
|
||||||
|
MYSQL_USER: wordpress
|
||||||
|
MYSQL_PASSWORD: wordpress
|
||||||
|
|
||||||
|
wordpress:
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
image: wordpress:latest
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
WORDPRESS_DB_HOST: db:3306
|
||||||
|
WORDPRESS_DB_USER: wordpress
|
||||||
|
WORDPRESS_DB_PASSWORD: wordpress
|
||||||
|
WORDPRESS_DB_NAME: wordpress
|
||||||
|
volumes:
|
||||||
|
db_data: {}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
rocketchat:
|
||||||
|
image: rocketchat/rocket.chat:latest
|
||||||
|
command: >
|
||||||
|
bash -c
|
||||||
|
"for i in `seq 1 30`; do
|
||||||
|
node main.js &&
|
||||||
|
s=$$? && break || s=$$?;
|
||||||
|
echo \"Tried $$i times. Waiting 5 secs...\";
|
||||||
|
sleep 5;
|
||||||
|
done; (exit $$s)"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./uploads:/app/uploads
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
- ROOT_URL=http://localhost:3000
|
||||||
|
- MONGO_URL=mongodb://mongo:27017/rocketchat
|
||||||
|
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
|
||||||
|
- MAIL_URL=smtp://smtp.email
|
||||||
|
# - HTTP_PROXY=http://proxy.domain.com
|
||||||
|
# - HTTPS_PROXY=http://proxy.domain.com
|
||||||
|
depends_on:
|
||||||
|
- mongo
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
labels:
|
||||||
|
- "traefik.backend=rocketchat"
|
||||||
|
- "traefik.frontend.rule=Host: your.domain.tld"
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo:4.0
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./data/db:/data/db
|
||||||
|
#- ./data/dump:/dump
|
||||||
|
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=false"
|
||||||
|
|
||||||
|
# this container's job is just run the command to initialize the replica set.
|
||||||
|
# it will run the command and remove himself (it will not stay running)
|
||||||
|
mongo-init-replica:
|
||||||
|
image: mongo:4.0
|
||||||
|
command: >
|
||||||
|
bash -c
|
||||||
|
"for i in `seq 1 30`; do
|
||||||
|
mongo mongo/rocketchat --eval \"
|
||||||
|
rs.initiate({
|
||||||
|
_id: 'rs0',
|
||||||
|
members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
|
||||||
|
s=$$? && break || s=$$?;
|
||||||
|
echo \"Tried $$i times. Waiting 5 secs...\";
|
||||||
|
sleep 5;
|
||||||
|
done; (exit $$s)"
|
||||||
|
depends_on:
|
||||||
|
- mongo
|
||||||
|
|
||||||
|
# hubot, the popular chatbot (add the bot user first and change the password before starting this image)
|
||||||
|
hubot:
|
||||||
|
image: rocketchat/hubot-rocketchat:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- ROCKETCHAT_URL=rocketchat:3000
|
||||||
|
- ROCKETCHAT_ROOM=GENERAL
|
||||||
|
- ROCKETCHAT_USER=bot
|
||||||
|
- ROCKETCHAT_PASSWORD=botpassword
|
||||||
|
- BOT_NAME=bot
|
||||||
|
# you can add more scripts as you'd like here, they need to be installable by npm
|
||||||
|
- EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-diagnostics
|
||||||
|
depends_on:
|
||||||
|
- rocketchat
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=false"
|
||||||
|
volumes:
|
||||||
|
- ./scripts:/home/hubot/scripts
|
||||||
|
# this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier
|
||||||
|
ports:
|
||||||
|
- 3001:8080
|
||||||
|
|
||||||
|
#traefik:
|
||||||
|
# image: traefik:latest
|
||||||
|
# restart: unless-stopped
|
||||||
|
# command: >
|
||||||
|
# traefik
|
||||||
|
# --docker
|
||||||
|
# --acme=true
|
||||||
|
# --acme.domains='your.domain.tld'
|
||||||
|
# --acme.email='your@email.tld'
|
||||||
|
# --acme.entrypoint=https
|
||||||
|
# --acme.storagefile=acme.json
|
||||||
|
# --defaultentrypoints=http
|
||||||
|
# --defaultentrypoints=https
|
||||||
|
# --entryPoints='Name:http Address::80 Redirect.EntryPoint:https'
|
||||||
|
# --entryPoints='Name:https Address::443 TLS.Certificates:'
|
||||||
|
# ports:
|
||||||
|
# - 80:80
|
||||||
|
# - 443:443
|
||||||
|
# volumes:
|
||||||
|
# - /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
version: "2.1"
|
||||||
|
services:
|
||||||
|
plex:
|
||||||
|
image: linuxserver/plex
|
||||||
|
container_name: plex
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- VERSION=docker
|
||||||
|
- UMASK_SET=022 #optional
|
||||||
|
- PLEX_CLAIM= #optional
|
||||||
|
restart: unless-stopped
|
||||||
|
# Configuración permanente y ubicación de archivos de video
|
||||||
|
# volumes:
|
||||||
|
# - /users/usuario/plex/config:/config
|
||||||
|
# - /users/usuario/plex/Series:/tv
|
||||||
|
# - /users/usuario/plex/Movies:/movies
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue