forked from esa/asn1scc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (57 loc) · 2.71 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (57 loc) · 2.71 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
# Use build arguments to control user creation
ARG NON_ROOT_USER=false
ARG USERNAME=root
ARG USERID=0
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Install .NET 10 SDK via the official dotnet-install.sh script.
# Microsoft's apt repo for Ubuntu 22.04 (jammy) does not ship
# dotnet-sdk-10.0, so we install via the script instead.
# Ubuntu 22.04 is required (not 24.04+/Debian 12) because GNAT
# Community 2021 below ships an old `ld` that does not understand
# glibc 2.36+ `.relr.dyn` sections.
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates libicu70 libssl3 libstdc++6 zlib1g \
libgssapi-krb5-2 \
&& wget -q https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh \
&& chmod +x /tmp/dotnet-install.sh \
&& /tmp/dotnet-install.sh --channel 10.0 --install-dir /usr/share/dotnet \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
&& rm /tmp/dotnet-install.sh
ENV DOTNET_ROOT=/usr/share/dotnet
# Install system dependencies
RUN set -xe \
&& apt-get update -y \
&& apt-get install -y libfontconfig1 libdbus-1-3 libx11-6 libx11-xcb-dev cppcheck htop \
python3 python3-distutils python3-pytest gcc g++ make nuget libgit2-dev libssl-dev curl wget git unzip zip \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove \
&& apt-get clean
# Conditionally create non-root user and set permissions
RUN if [ "$NON_ROOT_USER" = "true" ]; then \
adduser --disabled-password --gecos '' --uid $USERID $USERNAME && \
mkdir -p /workdir /app && \
chown -R $USERNAME:$USERNAME /workdir /app; \
fi
# Switch to the appropriate user
USER $USERNAME
# Install SDKMAN
RUN curl -s "https://get.sdkman.io" | bash && \
echo "source $HOME/.sdkman/bin/sdkman-init.sh" >> $HOME/.bashrc && \
bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.9-oracle && sdk install scala 3.3.0 && sdk install sbt 1.9.0"
# Install GNAT and SPARK (temporarily switch back to root)
USER root
WORKDIR /gnat_tmp/
RUN wget -O gnat-2021-x86_64-linux-bin https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin \
&& git clone https://github.com/AdaCore/gnat_community_install_script.git \
&& chmod +x gnat_community_install_script/install_package.sh \
&& chmod +x gnat-2021-x86_64-linux-bin \
&& gnat_community_install_script/install_package.sh ./gnat-2021-x86_64-linux-bin /opt/GNAT/gnat-x86-2021 \
&& rm -rf /gnat_tmp/
# Add UV for efficient python version management
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ENV UV_HOME=/app/.uv
# Set back to the appropriate user
USER $USERNAME
WORKDIR /app/
ENV PATH="/opt/GNAT/gnat-x86-2021/bin:${PATH}"