This file contains hidden or 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
FROM node:lts-alpine3.13 | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . |
This file contains hidden or 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
version: "3.7" | |
services: | |
api: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
container_name: api-nodejs | |
environment: | |
- PORT=8000 |
This file contains hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"target": "es5", | |
"sourceMap": true, | |
"noImplicitAny": true, | |
"removeComments": true, | |
"preserveConstEnums": true, | |
"outDir": "dist", | |
"allowSyntheticDefaultImports": true, |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: spring-depl | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: spring | |
template: |
This file contains hidden or 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
# build | |
FROM node:lts-alpine3.13 as dist | |
# set workdir in to container | |
WORKDIR /app | |
COPY package.json ./ | |
COPY package-lock.json ./ | |
RUN npm ci --silent |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.pablohdz</groupId> | |
<artifactId>null-object-pattern</artifactId> | |
<version>1.0-SNAPSHOT</version> |
This file contains hidden or 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
############################## | |
## Java | |
############################## | |
.mtj.tmp/ | |
*.class | |
*.jar | |
*.war | |
*.ear | |
*.nar | |
hs_err_pid* |
This file contains hidden or 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
# Build Stage | |
FROM maven:3.8.1-openjdk-11-slim AS build | |
COPY src /home/app/src | |
COPY pom.xml /home/app | |
RUN mvn -f /home/app/pom.xml clean package | |
# Package stage | |
FROM openjdk:11-jre-slim | |
COPY --from=build /home/app/target/name-file-1.0-SNAPSHOT.jar /usr/local/lib/demo.jar | |
ENV PORT=8080 |
This file contains hidden or 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
final String className = file.readUTF(); | |
final String personName = file.readUTF(); | |
final int age = file.readInt(); | |
final Class<?> personClass = Class.forName(className); | |
final Constructor<?> constructor = | |
personClass.getConstructor(String.class, int.class); | |
return (Person) constructor.newInstance(personName, age); |
This file contains hidden or 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
package com.pablohdz.application; | |
import com.pablohdz.entities.Person; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Optional; |