-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathrun-userspace-convertor-ubuntu.Dockerfile
73 lines (60 loc) · 2.76 KB
/
run-userspace-convertor-ubuntu.Dockerfile
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
#NOTE: This Dockerfile should be executed from the root of the repository
# docker build . -f ./cmd/convertor/resources/samples/run-userspace-convertor-ubuntu.Dockerfile -t convertor
FROM ubuntu:latest AS base
# Required Build/Run Tools Dependencies for Overlaybd tools
RUN apt-get update && \
apt-get install -y ca-certificates && \
update-ca-certificates
RUN apt update && \
apt install -y libcurl4-openssl-dev libext2fs-dev libaio-dev mysql-server
# --- OVERLAYBD TOOLS ---
FROM base AS overlaybd-build
RUN apt update && \
apt install -y libgflags-dev libssl-dev libnl-3-dev libnl-genl-3-dev libzstd-dev && \
apt install -y zlib1g-dev binutils make git wget sudo tar gcc cmake build-essential g++ && \
apt install -y uuid-dev libjson-c-dev libkmod-dev libsystemd-dev autoconf automake libtool libpci-dev nasm && \
apt install -y pkg-config
# Download and install Golang version 1.21
RUN wget https://go.dev/dl/go1.23.2.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz && \
rm go1.23.2.linux-amd64.tar.gz
# Set environment variables
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/go"
RUN git clone https://github.com/containerd/overlaybd.git && \
cd overlaybd && \
git submodule update --init && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=0 -DENABLE_DSA=0 -DENABLE_ISAL=0 && \
make -j8 && \
make install
# --- BUILD LOCAL CONVERTER ---
FROM overlaybd-build AS convert-build
WORKDIR /home/limiteduser/accelerated-container-image
COPY . .
WORKDIR /home/limiteduser/accelerated-container-image
RUN make
# --- FINAL ---
FROM base
WORKDIR /home/limiteduser/
# Copy Conversion Tools
COPY --from=overlaybd-build /opt/overlaybd/bin /opt/overlaybd/bin
COPY --from=overlaybd-build /opt/overlaybd/lib /opt/overlaybd/lib
COPY --from=overlaybd-build /opt/overlaybd/baselayers /opt/overlaybd/baselayers
# This is necessary for overlaybd_apply to work
COPY --from=overlaybd-build /etc/overlaybd/overlaybd.json /etc/overlaybd/overlaybd.json
COPY --from=convert-build /home/limiteduser/accelerated-container-image/bin/convertor ./bin/convertor
# EXTRAS
# Useful resources
COPY cmd/convertor/resources/samples/mysql.conf ./mysql.conf
COPY cmd/convertor/resources/samples/mysql-db-setup.sh ./mysql-db-setup.sh
COPY cmd/convertor/resources/samples/mysql-db-manifest-cache-sample-workload.sh ./mysql-db-manifest-cache-sample-workload.sh
RUN apt update && apt install -y wget
# Add Oras CLI
RUN wget "https://github.com/oras-project/oras/releases/download/v1.2.0/oras_1.2.0_linux_amd64.tar.gz" && \
mkdir -p oras-install/ && \
tar -zxf oras_1.2.0_*.tar.gz -C oras-install/ && \
mv oras-install/oras /usr/local/bin/ && \
rm -rf oras_1.2.0_*.tar.gz oras-install/
CMD ["./bin/convertor"]