Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: parametrize services Dockerfile path #1600

Merged
merged 8 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
36 changes: 36 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,62 @@ OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative
# ******************
# Core Demo Services
# ******************
# Accounting Service
ACCOUNTING_SERVICE_PATH=./src/accountingservice/
ACCOUNTING_SERVICE_DOCKERFILE=${ACCOUNTING_SERVICE_PATH}/Dockerfile

# Ad Service
AD_SERVICE_PORT=9555
AD_SERVICE_ADDR=adservice:${AD_SERVICE_PORT}
AD_SERVICE_PATH=./src/adservice
AD_SERVICE_DOCKERFILE=${AD_SERVICE_PATH}/Dockerfile

# Cart Service
CART_SERVICE_PORT=7070
CART_SERVICE_ADDR=cartservice:${CART_SERVICE_PORT}
CART_SERVICE_PATH=./src/cartservice
CART_SERVICE_DOCKERFILE=${CART_SERVICE_PATH}/src/Dockerfile

# Checkout Service
CHECKOUT_SERVICE_PORT=5050
CHECKOUT_SERVICE_ADDR=checkoutservice:${CHECKOUT_SERVICE_PORT}
CHECKOUT_SERVICE_PATH=./src/checkoutservice
CHECKOUT_SERVICE_DOCKERFILE=${CHECKOUT_SERVICE_PATH}/Dockerfile

# Currency Service
CURRENCY_SERVICE_PORT=7001
CURRENCY_SERVICE_ADDR=currencyservice:${CURRENCY_SERVICE_PORT}
CURRENCY_SERVICE_PATH=./src/currencyservice
CURRENCY_SERVICE_DOCKERFILE=${CURRENCY_SERVICE_PATH}/Dockerfile

# Email Service
EMAIL_SERVICE_PORT=6060
EMAIL_SERVICE_ADDR=http://emailservice:${EMAIL_SERVICE_PORT}
EMAIL_SERVICE_PATH=./src/emailservice
EMAIL_SERVICE_DOCKERFILE=${EMAIL_SERVICE_PATH}/Dockerfile

# Fraud Service
FRAUD_SERVICE_PATH=./src/frauddetectionservice
FRAUD_SERVICE_DOCKERFILE=${FRAUD_SERVICE_PATH}/Dockerfile

# Frontend
FRONTEND_PORT=8080
FRONTEND_ADDR=frontend:${FRONTEND_PORT}
FRONTEND_PATH=./src/frontend
FRONTEND_DOCKERFILE=${FRONTEND_PATH}/Dockerfile

# Frontend Proxy (Envoy)
FRONTEND_HOST=frontend
ENVOY_PORT=8080
FRONTEND_PROXY_ADDR=frontend-proxy:${ENVOY_PORT}
FRONTEND_PROXY_PATH=./src/frontendproxy
FRONTEND_PROXY_DOCKERFILE=${FRONTEND_PROXY_PATH}/Dockerfile

# Image Provider
IMAGE_PROVIDER_HOST=imageprovider
IMAGE_PROVIDER_PORT=8081
IMAGE_PROVIDER_PATH=./src/imageprovider
IMAGE_PROVIDER_DOCKERFILE=${IMAGE_PROVIDER_PATH}/Dockerfile

# Load Generator
LOCUST_WEB_PORT=8089
Expand All @@ -77,26 +101,38 @@ LOCUST_HOST=http://${FRONTEND_PROXY_ADDR}
LOCUST_WEB_HOST=loadgenerator
LOCUST_AUTOSTART=true
LOCUST_HEADLESS=false
LOAD_GENERATOR_PATH=./src/loadgenerator
LOAD_GENERATOR_DOCKERFILE=${LOAD_GENERATOR_PATH}/Dockerfile

# Payment Service
PAYMENT_SERVICE_PORT=50051
PAYMENT_SERVICE_ADDR=paymentservice:${PAYMENT_SERVICE_PORT}
PAYMENT_SERVICE_PATH=./src/paymentservice
PAYMENT_SERVICE_DOCKERFILE=${PAYMENT_SERVICE_PATH}/Dockerfile

# Product Catalog Service
PRODUCT_CATALOG_SERVICE_PORT=3550
PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:${PRODUCT_CATALOG_SERVICE_PORT}
PRODUCT_CATALOG_PATH=./src/productcatalogservice
PRODUCT_CATALOG_DOCKERFILE=${PRODUCT_CATALOG_PATH}/Dockerfile

# Quote Service
QUOTE_SERVICE_PORT=8090
QUOTE_SERVICE_ADDR=http://quoteservice:${QUOTE_SERVICE_PORT}
QUOTE_SERVICE_PATH=./src/quoteservice
QUOTE_SERVICE_DOCKERFILE=${QUOTE_SERVICE_PATH}/Dockerfile

# Recommendation Service
RECOMMENDATION_SERVICE_PORT=9001
RECOMMENDATION_SERVICE_ADDR=recommendationservice:${RECOMMENDATION_SERVICE_PORT}
RECOMMENDATION_SERVICE_PATH=./src/recommendationservice
RECOMMENDATION_SERVICE_DOCKERFILE=${RECOMMENDATION_SERVICE_PATH}/Dockerfile

# Shipping Service
SHIPPING_SERVICE_PORT=50050
SHIPPING_SERVICE_ADDR=shippingservice:${SHIPPING_SERVICE_PORT}
SHIPPING_SERVICE_PATH=./src/shippingservice
SHIPPING_SERVICE_DOCKERFILE=${SHIPPING_SERVICE_PATH}/Dockerfile

# ******************
# Dependent Services
Expand Down
26 changes: 13 additions & 13 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
container_name: ad-service
build:
context: ./
dockerfile: ./src/adservice/Dockerfile
dockerfile: ${AD_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-adservice
deploy:
Expand Down Expand Up @@ -53,7 +53,7 @@ services:
container_name: cart-service
build:
context: ./
dockerfile: ./src/cartservice/src/Dockerfile
dockerfile: ${CART_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-cartservice
deploy:
Expand Down Expand Up @@ -84,7 +84,7 @@ services:
container_name: checkout-service
build:
context: ./
dockerfile: ./src/checkoutservice/Dockerfile
dockerfile: ${CHECKOUT_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-checkoutservice
deploy:
Expand Down Expand Up @@ -130,7 +130,7 @@ services:
container_name: currency-service
build:
context: ./
dockerfile: ./src/currencyservice/Dockerfile
dockerfile: ${CURRENCY_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-currencyservice
deploy:
Expand Down Expand Up @@ -182,7 +182,7 @@ services:
container_name: frontend
build:
context: ./
dockerfile: ./src/frontend/Dockerfile
dockerfile: ${FRONTEND_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-frontend
deploy:
Expand Down Expand Up @@ -241,7 +241,7 @@ services:
container_name: frontend-proxy
build:
context: ./
dockerfile: src/frontendproxy/Dockerfile
dockerfile: ${FRONTEND_PROXY_DOCKERFILE}
deploy:
resources:
limits:
Expand Down Expand Up @@ -284,7 +284,7 @@ services:
container_name: imageprovider
build:
context: ./
dockerfile: ./src/imageprovider/Dockerfile
dockerfile: ${IMAGE_PROVIDER_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-imageprovider
deploy:
Expand All @@ -311,7 +311,7 @@ services:
container_name: load-generator
build:
context: ./
dockerfile: ./src/loadgenerator/Dockerfile
dockerfile: ${LOAD_GENERATOR_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-loadgenerator
deploy:
Expand Down Expand Up @@ -349,7 +349,7 @@ services:
container_name: payment-service
build:
context: ./
dockerfile: ./src/paymentservice/Dockerfile
dockerfile: ${PAYMENT_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
deploy:
Expand Down Expand Up @@ -377,7 +377,7 @@ services:
container_name: product-catalog-service
build:
context: ./
dockerfile: ./src/productcatalogservice/Dockerfile
dockerfile: ${PRODUCT_CATALOG_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
deploy:
Expand Down Expand Up @@ -405,7 +405,7 @@ services:
container_name: quote-service
build:
context: ./
dockerfile: ./src/quoteservice/Dockerfile
dockerfile: ${QUOTE_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-quoteservice
deploy:
Expand Down Expand Up @@ -433,7 +433,7 @@ services:
container_name: recommendation-service
build:
context: ./
dockerfile: ./src/recommendationservice/Dockerfile
dockerfile: ${RECOMMENDATION_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice
deploy:
Expand Down Expand Up @@ -466,7 +466,7 @@ services:
container_name: shipping-service
build:
context: ./
dockerfile: ./src/shippingservice/Dockerfile
dockerfile: ${SHIPPING_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-shippingservice
deploy:
Expand Down
35 changes: 18 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
container_name: accounting-service
build:
context: ./
dockerfile: ./src/accountingservice/Dockerfile
dockerfile: ${ACCOUNTING_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-accountingservice
deploy:
Expand All @@ -50,7 +50,7 @@ services:
container_name: ad-service
build:
context: ./
dockerfile: ./src/adservice/Dockerfile
dockerfile: ${AD_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-adservice
deploy:
Expand Down Expand Up @@ -82,7 +82,7 @@ services:
container_name: cart-service
build:
context: ./
dockerfile: ./src/cartservice/src/Dockerfile
dockerfile: ${CART_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-cartservice
deploy:
Expand Down Expand Up @@ -116,7 +116,7 @@ services:
container_name: checkout-service
build:
context: ./
dockerfile: ./src/checkoutservice/Dockerfile
dockerfile: ${CHECKOUT_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-checkoutservice
deploy:
Expand Down Expand Up @@ -168,7 +168,7 @@ services:
container_name: currency-service
build:
context: ./
dockerfile: ./src/currencyservice/Dockerfile
dockerfile: ${CURRENCY_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-currencyservice
deploy:
Expand All @@ -190,10 +190,11 @@ services:

# Email service
emailservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice
image: demo/emailservice-contrib:latest
container_name: email-service
build:
context: ./src/emailservice
context: ./
dockerfile: ${EMAIL_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice
deploy:
Expand All @@ -220,7 +221,7 @@ services:
container_name: frauddetection-service
build:
context: ./
dockerfile: ./src/frauddetectionservice/Dockerfile
dockerfile: ${FRAUD_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-frauddetectionservice
deploy:
Expand Down Expand Up @@ -251,7 +252,7 @@ services:
container_name: frontend
build:
context: ./
dockerfile: ./src/frontend/Dockerfile
dockerfile: ${FRONTEND_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-frontend
deploy:
Expand Down Expand Up @@ -312,7 +313,7 @@ services:
container_name: frontend-proxy
build:
context: ./
dockerfile: src/frontendproxy/Dockerfile
dockerfile: ${FRONTEND_PROXY_DOCKERFILE}
deploy:
resources:
limits:
Expand Down Expand Up @@ -355,7 +356,7 @@ services:
container_name: imageprovider
build:
context: ./
dockerfile: ./src/imageprovider/Dockerfile
dockerfile: ${IMAGE_PROVIDER_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-imageprovider
deploy:
Expand All @@ -382,7 +383,7 @@ services:
container_name: load-generator
build:
context: ./
dockerfile: ./src/loadgenerator/Dockerfile
dockerfile: ${LOAD_GENERATOR_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-loadgenerator
deploy:
Expand Down Expand Up @@ -420,7 +421,7 @@ services:
container_name: payment-service
build:
context: ./
dockerfile: ./src/paymentservice/Dockerfile
dockerfile: ${PAYMENT_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
deploy:
Expand Down Expand Up @@ -451,7 +452,7 @@ services:
container_name: product-catalog-service
build:
context: ./
dockerfile: ./src/productcatalogservice/Dockerfile
dockerfile: ${PRODUCT_CATALOG_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
deploy:
Expand Down Expand Up @@ -482,7 +483,7 @@ services:
container_name: quote-service
build:
context: ./
dockerfile: ./src/quoteservice/Dockerfile
dockerfile: ${QUOTE_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-quoteservice
deploy:
Expand Down Expand Up @@ -510,7 +511,7 @@ services:
container_name: recommendation-service
build:
context: ./
dockerfile: ./src/recommendationservice/Dockerfile
dockerfile: ${RECOMMENDATION_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice
deploy:
Expand Down Expand Up @@ -546,7 +547,7 @@ services:
container_name: shipping-service
build:
context: ./
dockerfile: ./src/shippingservice/Dockerfile
dockerfile: ${SHIPPING_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-shippingservice
deploy:
Expand Down
4 changes: 2 additions & 2 deletions src/emailservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ FROM base as builder

WORKDIR /tmp

COPY Gemfile Gemfile.lock .
COPY ./src/emailservice/Gemfile ./src/emailservice/Gemfile.lock ./
julianocosta89 marked this conversation as resolved.
Show resolved Hide resolved

#RUN apk update && apk add make gcc musl-dev gcompat && bundle install
RUN apt-get update && apt-get install build-essential -y && bundle install
FROM base as release

WORKDIR /email_server

COPY . .
COPY ./src/emailservice/ .

RUN chmod 666 ./Gemfile.lock

Expand Down
Loading