Add Docker files, Update styles

This commit is contained in:
MrLetsplay 2024-01-14 20:04:05 +01:00
parent 43771ff9d6
commit ff4445035a
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
7 changed files with 77 additions and 12 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/TEST /TEST
/target/ /target/
/files/ /files/
/dependency-reduced-pom.xml

33
docker/Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM maven:latest as builder
COPY . /workspace
WORKDIR /workspace
RUN mvn clean package
FROM alpine:latest
ENV UID=1000
ENV GID=1000
RUN apk update && apk add openjdk17 shadow sudo
COPY --from=builder /workspace/target/MdBlog-*.jar /mdblog/MdBlog.jar
COPY --from=mrletsplay/docker_launcher /usr/local/bin/docker_launcher /usr/local/bin/docker_launcher
COPY ./docker/launcher_config.json /mdblog/launcher_config.json
RUN useradd mdblog
RUN mkdir /mdblog/data && chown -R mdblog /mdblog/data
VOLUME ["/mdblog/data"]
WORKDIR /mdblog/data
EXPOSE 3706
ENTRYPOINT [ "docker_launcher", "--config", "/mdblog/launcher_config.json", "sudo", "-u", "mdblog" ]
CMD [ "java", "-jar", "/mdblog/MdBlog.jar" ]

View File

@ -0,0 +1,11 @@
{
"updateUID": true,
"user": "mdblog",
"updateGID": true,
"group": "mdblog",
"runBefore": [
[ "chown", "-R", "mdblog:mdblog", "/mdblog" ]
]
}

32
pom.xml
View File

@ -2,9 +2,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>MDTest</groupId> <groupId>me.mrletsplay</groupId>
<artifactId>MDTest</artifactId> <artifactId>MdBlog</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<plugins> <plugins>
@ -13,8 +13,34 @@
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<release>17</release> <release>17</release>
<encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<mainClass>me.mrletsplay.mdblog.MdBlog</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -15,7 +15,7 @@ public record PostMetadata(Instant date, String title, String author, Set<String
String author = "Unknown Author"; String author = "Unknown Author";
Set<String> tags = Collections.emptySet(); Set<String> tags = Collections.emptySet();
for(String line : metadataString.split("\n")) { for(String line : metadataString.split("\n")) {
if(line.isEmpty()) continue; if(line.isBlank()) continue;
String[] spl = line.split(":", 2); String[] spl = line.split(":", 2);
if(spl.length != 2) { if(spl.length != 2) {
System.err.println("Invalid metadata line: " + line); System.err.println("Invalid metadata line: " + line);

View File

@ -1,7 +1,4 @@
body { body {
filter: invert(); background-color: black;
color: white;
} }
h1 {
background-color: red;
}

View File

@ -1,3 +0,0 @@
h2 {
background-color: orange;
}