-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.base
More file actions
105 lines (91 loc) · 3.96 KB
/
Dockerfile.base
File metadata and controls
105 lines (91 loc) · 3.96 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
93
94
95
96
97
98
99
100
101
102
103
104
105
# syntax=docker/dockerfile:1
# Base image for memo.d.foundation builds
# Uses official Elixir image for reliability, then installs Node.js, DuckDB, pnpm, and other tools
FROM elixir:1.18.4-otp-26 as base
LABEL maintainer="anhnx@d.foundation" \
org.opencontainers.image.title="Memo.d.foundation Base Build Environment" \
org.opencontainers.image.description="Base image with Elixir, Node.js, DuckDB, and build tools" \
org.opencontainers.image.source="https://github.com/dwarvesf/memo.d.foundation" \
org.opencontainers.image.version="1.0.0"
# Set locale environment variables for UTF-8 support
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
NODE_ENV=production \
MIX_ENV=prod \
MAKEFLAGS="-j$(nproc)"
# Install system dependencies and build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
bash \
unzip \
build-essential \
locales \
ca-certificates \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# Set up UTF-8 locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8
# Install Node.js (LTS) from NodeSource
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \
apt-get install -y nodejs && \
node --version && npm --version
# Install DuckDB
RUN echo "Installing DuckDB..." && \
curl -L --connect-timeout 30 --max-time 300 --retry 3 --retry-delay 10 \
https://github.com/duckdb/duckdb/releases/download/v1.2.2/duckdb_cli-linux-amd64.zip \
-o duckdb.zip && \
unzip duckdb.zip && \
mv duckdb /usr/local/bin/ && \
chmod +x /usr/local/bin/duckdb && \
rm duckdb.zip && \
echo "DuckDB installed successfully"
# Install and configure pnpm globally
RUN echo "Installing pnpm..." && \
npm install -g pnpm@10.11.0 && \
pnpm config set store-dir /root/.pnpm-store && \
pnpm config set cache-dir /root/.pnpm-cache && \
pnpm config set network-timeout 60000 && \
pnpm config set fetch-retries 3 && \
pnpm config set fetch-retry-mintimeout 10000 && \
pnpm config set fetch-retry-maxtimeout 60000
# Set up Elixir environment with proper configuration
RUN echo "Setting up Elixir environment..." && \
mix local.hex --force && \
mix local.rebar --force && \
mix hex.config api_url https://hex.pm/api && \
mix hex.config offline false && \
mix hex.config http_timeout 60000 && \
mix hex.config http_concurrency 8 && \
mkdir -p /root/.mix && \
mkdir -p /root/.hex
# Configure Git for optimal performance in container environment
RUN echo "Configuring Git..." && \
git config --global init.defaultBranch main && \
git config --global advice.detachedHead false && \
git config --global gc.auto 0 && \
git config --global fetch.parallel 4 && \
git config --global submodule.fetchJobs 4 && \
git config --global protocol.version 2 && \
git config --global url."https://github.com/".insteadOf "git@github.com:"
# Create working directory
WORKDIR /code
# Verify all tools are working
RUN echo "Verifying installation..." && \
echo "Elixir version: $(elixir --version | head -1)" && \
echo "Erlang version: $(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell)" && \
echo "Node.js version: $(node --version)" && \
echo "npm version: $(npm --version)" && \
echo "pnpm version: $(pnpm --version)" && \
echo "Git version: $(git --version)" && \
echo "DuckDB version: $(duckdb --version)" && \
echo "Debian version: $(cat /etc/debian_version)" && \
echo "Build tools: $(gcc --version | head -1)" && \
echo "All tools installed successfully!"
# Health check to ensure the base image is working
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD elixir --version && node --version && duckdb --version || exit 1
# Default command
CMD ["sh"]