Skip to content

Instantly share code, notes, and snippets.

Stream<BigDecimal> bigDecimalNumber =
Stream.of(BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN);
BigDecimal result = bigDecimalNumber.reduce(BigDecimal.ZERO, BigDecimal::add);
assertEquals(11, result);
Stream<Integer> intNumbers = Stream.of(5, 1, 100);
int result = intNumbers.reduce(0, Integer::sum);
assertEquals(106, result);
List<Double> doubleNumbers = Arrays.asList(23.48, 52.26, 13.5);
double result = doubleNumbers.stream()
.mapToDouble(Double::doubleValue)
.sum();
assertEquals(89.24, result, .1);
deployment:
parameters:
microservice_name:
type: string
machine: true
steps:
- checkout
- kubernetes/install
- aws-eks/update-kubeconfig-with-authenticator:
cluster-name: "flask-starter-cluster"
- run:
name: Build Docker image
command: |
cd << parameters.microservice_name >>
docker-compose build server
docker tag <<parameters.tag_name>>:latest "${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"/<< parameters.microservice_name>>:dev
- aws-cli/install
- aws-cli/setup
- run:
name: Create ECR repository
deploy-dev:
machine: true
steps:
- checkout
- run:
name: Build and push Docker image to development
command: |
docker build -t fabripautasso/node-starter-v2 .
docker pull wagoodman/dive
docker run --rm -it \
@fabripautasso
fabripautasso / dive_final_dockerfile
Created April 7, 2020 13:56
Final Dockerfile for Dive article
# Start with Ubuntu Trusty
FROM phusion/baseimage:0.10.0 AS BuildImage
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
RUN apt-get update && apt-get install -y \
wget \
curl \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
@fabripautasso
fabripautasso / dive_multi_stage_dockerfile
Created April 6, 2020 10:03
Multi-stage Dockerfile for Dive tutorial
# Start with Ubuntu Trusty
FROM phusion/baseimage:0.10.0 AS BuildImage
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
RUN apt-get update && apt-get install -y \
wget \
curl \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
@fabripautasso
fabripautasso / dive_initial_dockerfile
Created April 6, 2020 09:08
Initial Dockerfile, dive tutorial
# Start with Ubuntu Trusty
FROM phusion/baseimage:0.10.0
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
RUN apt-get update
RUN apt-get -y install wget
RUN apt-get -y install curl
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
apiVersion: v1
kind: Service
metadata:
name: {{ include "node-starter.fullname" . }}
labels:
{{- include "node-starter.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}