-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (58 loc) · 1.98 KB
/
Copy pathDockerfile
File metadata and controls
73 lines (58 loc) · 1.98 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
# syntax=docker/dockerfile:1
# Mayam — Multi-Architecture Docker Image
# Supports linux/amd64 and linux/arm64
#
# Build:
# docker buildx build --platform linux/amd64,linux/arm64 -t mayam:latest .
#
# Run:
# docker run -p 11112:11112 -p 8080:8080 -p 8081:8081 mayam:latest
#
# Reference: Milestone 13 — Docker / OCI container images
# ============================================================
# Stage 1: Build
# ============================================================
FROM swift:6.2-jammy AS builder
WORKDIR /build
# Copy package manifest first for dependency caching
COPY Package.swift ./
RUN swift package resolve
# Copy source code
COPY Sources/ Sources/
COPY Config/ Config/
# Build release binary
RUN swift build -c release --static-swift-stdlib \
-Xlinker -lstdc++ \
&& mv .build/release/mayam /build/mayam
# ============================================================
# Stage 2: Runtime
# ============================================================
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libicu70 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN groupadd -r mayam && useradd -r -g mayam -d /var/lib/mayam -s /bin/false mayam
# Create directories
RUN mkdir -p /var/lib/mayam/archive /etc/mayam /var/log/mayam \
&& chown -R mayam:mayam /var/lib/mayam /var/log/mayam
# Copy binary and default configuration
COPY --from=builder /build/mayam /usr/local/bin/mayam
COPY Config/mayam.yaml /etc/mayam/mayam.yaml
# Environment variable defaults
ENV MAYAM_CONFIG=/etc/mayam/mayam.yaml \
MAYAM_STORAGE_ARCHIVE_PATH=/var/lib/mayam/archive \
MAYAM_LOG_LEVEL=info
# Expose ports
# 11112 - DICOM associations
# 8080 - DICOMweb HTTP
# 8081 - Admin console
EXPOSE 11112 8080 8081
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Run as non-root user
USER mayam
ENTRYPOINT ["mayam"]