Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions auth-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.18.2
COPY . /app
WORKDIR /app

ENV GO111MODULE=on
ENV JWT_SECRET=PRFT
ENV AUTH_API_PORT=8000
ENV USERS_API_ADDRESS=http://127.0.0.1:8083

RUN go mod init github.com/bortizf/microservice-app-example/tree/master/auth-api
RUN go mod tidy
RUN go build

CMD ["./auth-api"]

82 changes: 82 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: '3.8'

services:
redis:
image: redis:7.0
ports:
- "6379:6379"
zipkin:
image: openzipkin/zipkin
ports:
- 9411:9411

auth-api:
build: ./auth-api
image: j0tunh3im/auth-api:0.1.0
environment:
- AUTH_API_PORT=8000
- USERS_API_ADDRESS=http://users-api:8083
- JWT_SECRET=PRFT
ports:
- "8000:8000"
depends_on:
- zipkin
- users-api

frontend:
build: ./frontend
image: j0tunh3im/frontend:0.1.0
environment:
- PORT=8080
- AUTH_API_ADDRESS=http://auth-api:8000
- TODOS_API_ADDRESS=http://todos-api:8082
ports:
- "8080:8080"
depends_on:
- zipkin
- auth-api
- todos-api
- users-api


log-message-processor:
build: ./log-message-processor
image: j0tunh3im/log-message:0.1.0
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_CHANNEL=log_channel
depends_on:
- zipkin
- redis

todos-api:
build: ./todos-api
image: j0tunh3im/todos-api:0.1.0
environment:
- TODO_API_PORT=8082
- JWT_SECRET=PRFT
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_CHANNEL=log_channel
ports:
- "8082:8082"
depends_on:
- zipkin
- redis

users-api:
build: ./users-api
image: j0tunh3im/users-api:0.1.0
environment:
- SERVER_PORT=8083
- JWT_SECRET=PRFT
ports:
- "8083:8083"
depends_on:
- zipkin

networks:
default:
external:
name: distribuidos
Binary file added evidence/added-todo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added evidence/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added evidence/console2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added evidence/frontend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Utiliza una imagen base de Node.js
FROM node:8.17.0

# Establece el directorio de trabajo en /app
WORKDIR /app

# Copia el archivo package.json y package-lock.json a la imagen
COPY package*.json ./

# Instala las dependencias de Node.js
RUN npm install

# Copia el resto de los archivos de la aplicación a la imagen
COPY . .

# Establece las variables de entorno requeridas
ENV PORT=8080
ENV AUTH_API_ADDRESS=http://127.0.0.1:8000
ENV TODOS_API_ADDRESS=http://127.0.0.1:8082

# Compila la aplicación (asegúrate de que tengas un script "build" definido en tu package.json)
RUN npm run build

# Expone el puerto 8080
EXPOSE 8080

# Comando para iniciar la aplicación
CMD ["npm", "start"]

23 changes: 23 additions & 0 deletions log-message-processor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Usar una imagen base de Python
FROM python:3.6

# Directorio de trabajo en el contenedor
WORKDIR /app

# Copiar el archivo de requisitos al contenedor
COPY requirements.txt /app/

# Instalar las dependencias usando pip3
RUN pip3 install -r requirements.txt

# Definir las variables de entorno para Redis
ENV REDIS_HOST=127.0.0.1
ENV REDIS_PORT=6379
ENV REDIS_CHANNEL=log_channel

# Copiar el código fuente de la aplicación al contenedor
COPY . /app

# Ejecutar el script principal
CMD ["python3", "main.py"]

25 changes: 25 additions & 0 deletions todos-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use the official Node.js image as the base image
FROM node:8.17.0

# Establece el directorio de trabajo en /app
WORKDIR /app

# Copia el archivo package.json y package-lock.json al directorio de trabajo
COPY package*.json ./

# Instala las dependencias de la aplicación
RUN npm install

# Copia todo el contenido del directorio actual al directorio de trabajo
COPY . .

# Define las variables de entorno
ENV JWT_SECRET=PRFT
ENV TODO_API_PORT=8082

# Expone el puerto 8082 (puede ser diferente al puerto de escucha de tu aplicación)
EXPOSE 8082

# Inicia la aplicación
CMD ["npm", "start"]

21 changes: 21 additions & 0 deletions users-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use the official OpenJDK 11 image as a parent image
FROM openjdk:8-jdk

# Create a directory to store the application JAR file
WORKDIR /app

# Copy the JAR file into the container
COPY . .

RUN ./mvnw clean install

# Set environment variables
ENV JWT_SECRET=PRFT
ENV SERVER_PORT=8083

# Expose the port on which the application will run
EXPOSE $SERVER_PORT

# Command to run the application
CMD ["java", "-jar", "target/users-api-0.0.1-SNAPSHOT.jar"]