Rearrangement
32
.classpath
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="main"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="main"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
|
||||||
</classpath>
|
|
13
.gitignore
vendored
@ -1,12 +1,5 @@
|
|||||||
# Ignore Gradle project-specific cache directory
|
# Ignore cargo build outputs
|
||||||
.gradle
|
actix/target
|
||||||
|
|
||||||
# Ignore Gradle build output directory
|
# Ignore SQLite file
|
||||||
build
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
local.properties
|
|
||||||
url.iml
|
|
||||||
urls.csv
|
|
||||||
.env
|
|
||||||
urls.sqlite
|
urls.sqlite
|
||||||
|
34
.project
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>url</name>
|
|
||||||
<comment>Project url created by Buildship.</comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
||||||
</natures>
|
|
||||||
<filteredResources>
|
|
||||||
<filter>
|
|
||||||
<id>1667542035221</id>
|
|
||||||
<name></name>
|
|
||||||
<type>30</type>
|
|
||||||
<matcher>
|
|
||||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
||||||
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
||||||
</matcher>
|
|
||||||
</filter>
|
|
||||||
</filteredResources>
|
|
||||||
</projectDescription>
|
|
@ -1,13 +0,0 @@
|
|||||||
arguments=--init-script /home/sintan/.config/Code/User/globalStorage/redhat.java/1.12.0/config_linux/org.eclipse.osgi/51/0/.cp/gradle/init/init.gradle --init-script /home/sintan/.config/Code/User/globalStorage/redhat.java/1.12.0/config_linux/org.eclipse.osgi/51/0/.cp/gradle/protobuf/init.gradle
|
|
||||||
auto.sync=false
|
|
||||||
build.scans.enabled=false
|
|
||||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
|
||||||
connection.project.dir=
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
gradle.user.home=
|
|
||||||
java.home=/usr/lib/jvm/java-19-openjdk
|
|
||||||
jvm.arguments=
|
|
||||||
offline.mode=false
|
|
||||||
override.workspace.settings=true
|
|
||||||
show.console.view=true
|
|
||||||
show.executions.view=true
|
|
25
Dockerfile
@ -1,14 +1,21 @@
|
|||||||
FROM gradle:jdk17-alpine AS build
|
FROM rust:1 as build
|
||||||
COPY --chown=gradle:gradle . /home/gradle/src
|
|
||||||
WORKDIR /home/gradle/src
|
|
||||||
RUN gradle fatJar --no-daemon
|
|
||||||
|
|
||||||
FROM openjdk:17-alpine
|
RUN mkdir /actix
|
||||||
|
WORKDIR /actix
|
||||||
|
|
||||||
EXPOSE 4567
|
COPY ./actix/cargo.toml /actix/cargo.toml
|
||||||
|
COPY ./actix/cargo.lock /actix/cargo.lock
|
||||||
|
|
||||||
RUN mkdir /app
|
RUN cargo build --deps-only
|
||||||
|
|
||||||
COPY --from=build /home/gradle/src/build/libs/*.jar /app/application.jar
|
COPY ./actix /actix
|
||||||
|
|
||||||
ENTRYPOINT ["java", "-jar","/app/application.jar"]
|
RUN cargo install --path .
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/cc-debian10
|
||||||
|
|
||||||
|
EXPOSE 2000
|
||||||
|
|
||||||
|
COPY --from=build /usr/local/cargo/bin/actix /usr/local/bin/actix
|
||||||
|
|
||||||
|
CMD ["actix"]
|
||||||
|
1227
actix/Cargo.lock
generated
Normal file
10
actix/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "actix"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
actix-web = "4"
|
||||||
|
actix-files = "0.6.2"
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
19
actix/src/main.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
use actix_files::Files;
|
||||||
|
use actix_web::{get, web, App, HttpServer, Responder};
|
||||||
|
|
||||||
|
#[get("/hello/{name}")]
|
||||||
|
async fn greet(name: web::Path<String>) -> impl Responder {
|
||||||
|
format!("Hello {name}!")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[actix_web::main] // or #[tokio::main]
|
||||||
|
async fn main() -> std::io::Result<()> {
|
||||||
|
HttpServer::new(|| {
|
||||||
|
App::new()
|
||||||
|
.service(greet)
|
||||||
|
.service(Files::new("/", "./resources/").index_file("index.html"))
|
||||||
|
})
|
||||||
|
.bind(("127.0.0.1", 2000))?
|
||||||
|
.run()
|
||||||
|
.await
|
||||||
|
}
|