Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (75 loc) · 2.67 KB
/
Copy pathDockerfile
File metadata and controls
88 lines (75 loc) · 2.67 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
# syntax=docker/dockerfile:1
ARG UBUNTU_TAG=22.04
FROM ubuntu:${UBUNTU_TAG}
# --- Configurable (can be overridden with --build-arg) ---
ARG CMAKE_VERSION=3.26.4
ARG CMAKE_BASE_URL=https://github.com/Kitware/CMake/releases/download
ARG GITHUB_TOKEN
ENV DEBIAN_FRONTEND=noninteractive
# --- Base system setup --------------------------------------------------------
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
wget \
tar \
unzip \
zip \
pkg-config \
sudo \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Development tooling (optional)
RUN apt-get update && apt-get install -y \
valgrind \
gdb \
python3 \
python3-venv \
python3-pip \
perl \
autoconf \
automake \
libtool \
&& rm -rf /var/lib/apt/lists/*
# --- Install CMake from official binaries (arch-aware) ------------------------
RUN set -eux; \
ARCH="$(uname -m)"; \
case "$ARCH" in \
x86_64) CMAKE_ARCH=linux-x86_64 ;; \
aarch64) CMAKE_ARCH=linux-aarch64 ;; \
*) echo "Unsupported arch: $ARCH" >&2; exit 1 ;; \
esac; \
apt-get update && apt-get install -y wget tar && rm -rf /var/lib/apt/lists/*; \
wget -q "${CMAKE_BASE_URL}/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-${CMAKE_ARCH}.tar.gz" -O /tmp/cmake.tgz; \
tar --strip-components=1 -xzf /tmp/cmake.tgz -C /usr/local; \
rm -f /tmp/cmake.tgz
# --- Create a non-root 'dev' user with passwordless sudo ----------------------
RUN useradd --create-home --shell /bin/bash dev && \
echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
mkdir -p /workspace && chown dev:dev /workspace
USER dev
WORKDIR /workspace
# --- Optional Python venv for tools ------------------------------------------
RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --upgrade pip
ENV PATH="/opt/venv/bin:${PATH}"
# --- Build & install a-memory-library ---
RUN set -eux; \
git clone --depth 1 "https://github.com/andycurtis-public/a-memory-library.git" "a-memory-library" && \
cd a-memory-library && \
./build.sh install && \
cd .. && \
rm -rf a-memory-library
# --- Build & install the-macro-library ---
RUN set -eux; \
git clone --depth 1 "https://github.com/andycurtis-public/the-macro-library.git" "the-macro-library" && \
cd the-macro-library && \
./build.sh install && \
cd .. && \
rm -rf the-macro-library
# --- Build & install this project --------------------------------------------
COPY --chown=dev:dev . /workspace/sql-parser-library
RUN mkdir -p /workspace/build/sql-parser-library && \
cd /workspace/build/sql-parser-library && \
cmake /workspace/sql-parser-library && \
make -j"$(nproc)" && sudo make install
CMD ["/bin/bash"]