Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions forex-mtl/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Target directories
target/
project/target/
project/project/target/

# IDE files
.idea/
*.iml
.vscode/

# OS files
.DS_Store
Thumbs.db

# Git
.git/
.gitignore

# Temp files
*.log
*.tmp
tempDoNotCommit.txt

# Docker files (not needed inside container)
Dockerfile
docker-compose.yml
.dockerignore

# Documentation
README.md
50 changes: 50 additions & 0 deletions forex-mtl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Multi-stage build for Scala SBT project
FROM eclipse-temurin:17-jdk AS builder

# Install SBT
RUN apt-get update && \
apt-get install -y curl && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add && \
apt-get update && \
apt-get install -y sbt && \
rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy project files
COPY project project
COPY build.sbt .
COPY src src

# Build the application and create fat JAR
RUN sbt clean assembly

# Runtime stage - minimal JRE image
FROM eclipse-temurin:17-jre

# Install basic utilities
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN groupadd -r forex && useradd -r -g forex forex

# Set working directory
WORKDIR /app

# Copy the JAR from builder stage
COPY --from=builder /app/target/scala-2.13/forex-mtl.jar app.jar

# Change ownership to non-root user
RUN chown forex:forex app.jar
USER forex

# Expose port (from application.conf)
EXPOSE 8080

# Run the application
CMD ["java", "-jar", "app.jar"]
Loading