- Chile + Java = 1
- Chile + Santiago + Java = 1
¿y cual será el motivo si mi puntaje no ha cambiado? 😀
Blog dedicado principalmente a Java, mi intención es escribir información útil, compartir conocimiento, continuar difundiendo y apoyando a Java en todos lados
public class App {
public static void main(String[] args) throws MalformedURLException, IOException {
while (true) {
final var url = new java.net.URL(
new StringBuilder("http://")
.append(System.getenv("AWS_LAMBDA_RUNTIME_API"))
.append("/2018-06-01/runtime/invocation/next")
.toString());
final var conn = url.openConnection();
final var requestid = conn.getHeaderField("Lambda-Runtime-Aws-Request-Id");
try (final var is = conn.getInputStream()) {
int lee;
while ((lee = is.read()) != -1) {
System.out.print((char) lee);
}
}
((HttpURLConnection) conn).disconnect();
final var ok = new java.net.URL(
new StringBuilder("http://")
.append(System.getenv("AWS_LAMBDA_RUNTIME_API"))
.append("/2018-06-01/runtime/invocation/")
.append(requestid).append("/response")
.toString());
final var responsehttp = (HttpURLConnection) ok.openConnection();
responsehttp.setRequestMethod("POST");
responsehttp.setDoOutput(true);
responsehttp.connect();
try (final var os = responsehttp.getOutputStream()) {
os.write("ok".getBytes());
os.flush();
}
try (final var is = responsehttp.getInputStream()) {
int lee;
while ((lee = is.read()) != -1) {
System.out.print((char) lee);
}
}
responsehttp.disconnect();
}
}
}
FROM oracle/graalvm-ce:19.3.1-java11 as graalvm
COPY . /app
WORKDIR /app
RUN gu install native-image
RUN native-image --no-server -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:+JNI -H:+TraceServiceLoaderFeature -H:+StackTrace -jar target/lambda-graal-1.0-SNAPSHOT.jar
FROM frolvlad/alpine-glibc
COPY --from=graalvm /app/lambda-graal-1.0-SNAPSHOT /app/bootstrap
docker build -t demo .
docker run --rm demo cat /app/bootstrap > bootstrap
chmod +x bootstrap
zip function.zip bootstrap