Skip to content

Commit 16b48a1

Browse files
committed
Misc fixes
1 parent b5dc864 commit 16b48a1

File tree

3 files changed

+41
-27
lines changed

3 files changed

+41
-27
lines changed

Dockerfile

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,56 @@
11
# Docker for Convex
22

3-
# FROM maven:3.9.9-eclipse-temurin-22 AS build
4-
# #ENV HOME=/home/convex
5-
# WORKDIR $HOME
6-
# ADD . $HOME
7-
# RUN mvn clean package
3+
# Build stage
4+
FROM maven:3.9.9-eclipse-temurin-22-jammy AS build
5+
WORKDIR /build
6+
COPY . .
7+
RUN mvn clean install -DskipTests
88

99
# Run stage
10+
FROM eclipse-temurin:22-jre-alpine AS run
11+
12+
# Add labels
13+
LABEL org.opencontainers.image.title="Convex"
14+
LABEL org.opencontainers.image.description="Convex Peer Node"
15+
LABEL org.opencontainers.image.source="https://github.com/Convex-Dev/convex"
16+
17+
# Create non-root user
18+
RUN addgroup -S convex && adduser -S convex -G convex
19+
20+
# Set environment variables
21+
ENV HOME=/home/convex \
22+
CONVEX_HTTP_PORT=8080 \
23+
CONVEX_BINARY_PORT=18888 \
24+
CONVEX_HTTPS_PORT=443
1025

11-
FROM eclipse-temurin:22-jdk-alpine AS run
12-
ENV HOME=/home/convex
1326
WORKDIR $HOME
14-
COPY ./convex-integration/target/convex.jar convex.jar
1527

16-
##### Expose ports. These can be mapped to host ports
28+
# Copy application jar from build stage
29+
COPY --from=build /build/convex-integration/target/convex.jar convex.jar
1730

18-
# Convex binary protocol port
19-
EXPOSE 18888
31+
# Set proper permissions
32+
RUN chown -R convex:convex $HOME && \
33+
chmod 500 convex.jar
2034

21-
# HTTP port. Can be used for an HTTPS proxy
22-
EXPOSE 8080
35+
# Create and set permissions for volumes
36+
RUN mkdir -p /etc/convex/keystore && \
37+
chown -R convex:convex /etc/convex
2338

24-
# HTTPS port. Usable if server has a certificate
25-
EXPOSE 443
39+
# Switch to non-root user
40+
USER convex
2641

42+
# Expose ports
43+
EXPOSE $CONVEX_BINARY_PORT
44+
EXPOSE $CONVEX_HTTP_PORT
45+
EXPOSE $CONVEX_HTTPS_PORT
46+
47+
# Define volumes
2748
VOLUME ["/etc/ssl/certs"]
2849
VOLUME ["/etc/convex/keystore"]
2950

51+
# Health check
52+
HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
53+
CMD wget --no-verbose --tries=1 --spider http://localhost:${CONVEX_HTTP_PORT}/api/v1/status || exit 1
54+
3055
ENTRYPOINT ["java", "-jar", "convex.jar", "peer", "start"]
3156

convex-core/src/main/java/convex/core/store/AStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public abstract class AStore implements Closeable {
9090
*/
9191
public <T extends ACell> T getRootData() throws IOException {
9292
Ref<T> ref=getRootRef();
93-
if (ref==null) throw new MissingDataException(this,getRootHash());
93+
if (ref==null) return null;
9494
return ref.getValue();
9595
}
9696

convex-restapi/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,6 @@
4444
</executions>
4545
-->
4646
</plugin>
47-
<plugin>
48-
<groupId>org.apache.maven.plugins</groupId>
49-
<artifactId>maven-jar-plugin</artifactId>
50-
<configuration>
51-
<excludes>
52-
<!--
53-
<exclude>openapi-plugin/**</exclude>>
54-
-->
55-
</excludes>
56-
</configuration>
57-
</plugin>
5847
</plugins>
5948
</build>
6049

0 commit comments

Comments
 (0)