-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
92 lines (72 loc) · 2.54 KB
/
Copy pathDockerfile
File metadata and controls
92 lines (72 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Dockerfile for FIVUCSAS Client Apps - Desktop Application
# Multi-stage build for optimal image size
#
# This Dockerfile creates a containerized environment for running the Desktop application
# Follows Docker best practices and security guidelines
# Stage 1: Build Stage
FROM gradle:8.14-jdk21 AS builder
LABEL maintainer="FIVUCSAS Team"
LABEL description="FIVUCSAS Facial Identity Verification - Desktop App Builder"
# Set working directory
WORKDIR /app
# Copy Gradle configuration files first (for layer caching)
COPY gradle/ gradle/
COPY gradlew gradlew.bat gradle.properties settings.gradle.kts build.gradle.kts ./
# Copy source code
COPY shared/ shared/
COPY desktopApp/ desktopApp/
COPY androidApp/ androidApp/
COPY docs/ docs/
COPY *.md ./
# Build the application
RUN ./gradlew :desktopApp:packageDistributionForCurrentOS --no-daemon
# Stage 2: Runtime Stage
FROM openjdk:21-jdk-slim
LABEL maintainer="FIVUCSAS Team"
LABEL description="FIVUCSAS Facial Identity Verification - Desktop App Runtime"
LABEL version="1.0.0"
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libx11-6 \
libxext6 \
libxrender1 \
libxtst6 \
libxi6 \
libfreetype6 \
fontconfig \
&& rm -rf /var/lib/apt/lists/*
# Create application user (security best practice)
RUN groupadd -r fivucsas && useradd -r -g fivucsas -m -s /bin/bash fivucsas
# Set working directory
WORKDIR /home/fivucsas/app
# Copy built application from builder stage
COPY --from=builder --chown=fivucsas:fivucsas /app/desktopApp/build/compose/binaries/main/app/ ./
# Copy environment configuration
COPY --chown=fivucsas:fivucsas .env.example .env
# Switch to non-root user
USER fivucsas
# Expose any ports if needed (uncomment and adjust as needed)
# EXPOSE 8080
# Health check (adjust as needed for your application)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ps aux | grep -q '[j]ava' || exit 1
# Set environment variables
ENV APP_HOME=/home/fivucsas/app
ENV JAVA_OPTS="-Xmx2g -Xms512m"
# Run the application
CMD ["java", "-jar", "desktop-app.jar"]
# Alternative: Run with JVM options
# CMD ["sh", "-c", "java $JAVA_OPTS -jar desktop-app.jar"]
# Build instructions:
# docker build -t fivucsas-desktop:latest .
#
# Run instructions:
# docker run -it --rm \
# -e DISPLAY=$DISPLAY \
# -v /tmp/.X11-unix:/tmp/.X11-unix \
# --name fivucsas-desktop \
# fivucsas-desktop:latest
#
# For GUI applications, you may need to allow X11 forwarding:
# xhost +local:docker
# (Remember to revoke with: xhost -local:docker)