-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
44 lines (36 loc) · 1.24 KB
/
Containerfile
File metadata and controls
44 lines (36 loc) · 1.24 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
# Containerfile for PeaceFounder service
FROM docker.io/julia:1.11
# Application in /opt/peacefounder
WORKDIR /opt/peacefounder
# Copy and install Julia dependencies first (better caching)
COPY Project.toml Manifest.toml ./
RUN julia --project=. -e "using Pkg; Pkg.instantiate()"
# Copy application code
COPY . ./
# Auto-detect architecture and set CPU target, then precompile
RUN julia --project=. -e ' \
arch = Sys.ARCH; \
cpu_target = if arch == :x86_64; \
"generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)"; \
elseif arch == :aarch64; \
"generic;apple-m1"; \
else; \
"generic"; \
end; \
println("Detected Julia architecture: $arch"); \
println("Using JULIA_CPU_TARGET: $cpu_target"); \
using Pkg; \
withenv("JULIA_CPU_TARGET" => cpu_target) do; \
Pkg.precompile(); \
end; \
println("Precompilation completed with optimized target!"); \
'
# Use /home/peacefounder for data
ENV USER_DATA=/home/peacefounder
ENV PEACEFOUNDER_ADMIN_HOST="0.0.0.0"
# Create home directory structure
RUN mkdir -p /home/peacefounder
# Admin panel (localhost only) and entry point
EXPOSE 3221 4584
ENTRYPOINT ["julia", "--project=.", "main.jl"]
CMD [] # Containerfile for PeaceFounder service