-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
136 lines (100 loc) · 4.1 KB
/
Dockerfile
File metadata and controls
136 lines (100 loc) · 4.1 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#syntax=docker/dockerfile:1.12.1
# #############################################################################
# #############################################################################
# Base image
# https://hub.docker.com/_/ubuntu
ARG VERSION="24.04"
FROM ubuntu:${VERSION} AS base
# #############################################################################
# #############################################################################
# arm-none-eabi
FROM base AS arm-none-eabi_builder
# https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
ARG ARM_NANO_EABI_VERSION=14.2.rel1
WORKDIR /workdir
RUN \
apt-get update && \
apt-get install --yes --no-install-recommends wget ca-certificates xz-utils && \
rm -rf /var/lib/apt/lists/*
ARG TARGETARCH
RUN set -eux; \
case "${TARGETARCH}" in \
amd64) ARCH="x86_64" ;; \
arm64) ARCH="aarch64" ;; \
*) echo "Unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
esac; \
wget -qO- "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_NANO_EABI_VERSION}/binrel/arm-gnu-toolchain-${ARM_NANO_EABI_VERSION}-${ARCH}-arm-none-eabi.tar.xz" \
| tar -xJ --strip-components=1
# #############################################################################
# #############################################################################
# wine
FROM base AS wine_builder
RUN \
apt-get update && \
apt-get install --yes --no-install-recommends wget gnupg2 ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN \
. /etc/os-release && \
dpkg --add-architecture i386 && \
apt-get update && \
mkdir -p /etc/apt/keyrings && \
wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key && \
echo "deb [signed-by=/etc/apt/keyrings/winehq-archive.key] https://dl.winehq.org/wine-builds/ubuntu/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/winehq.list && \
apt-get update && \
apt-get install --yes --no-install-recommends winehq-stable && \
rm -rf /var/lib/apt/lists/*
# #############################################################################
# #############################################################################
# Production image
FROM base
# -----------------------------------------------------------------------------
# Packages to install
ARG PACKAGES="sudo bash wget curl git \
build-essential bc file \
cmake clang \
cpputest pahole ccache valgrind dos2unix \
astyle \
python3 python3-pip python3-venv \
clang-format clang-tidy \
shellcheck cppcheck cflow pmccabe \
doxygen graphviz"
RUN \
apt-get update && \
apt-get install --yes --no-install-recommends ${PACKAGES} && \
rm -rf /var/lib/apt/lists/*
# -----------------------------------------------------------------------------
# cpputest
ENV CPPUTEST_HOME="/usr/"
# -----------------------------------------------------------------------------
# arm-none-eabi
COPY --from=arm-none-eabi_builder /workdir /arm-none-eabi
ENV PATH=/arm-none-eabi/bin/:${PATH}
# -----------------------------------------------------------------------------
# wine
COPY --from=wine_builder /opt/wine-stable/ /opt/wine-stable/
COPY --from=wine_builder /usr/bin/ /usr/bin/
COPY --from=wine_builder /usr/lib/ /usr/lib/
# -----------------------------------------------------------------------------
# USER
ARG USERNAME="tedi"
# Rename default user
RUN usermod -l ${USERNAME} ubuntu && \
groupmod -n ${USERNAME} ubuntu && \
usermod -d /home/${USERNAME} -m ${USERNAME}
RUN echo "${USERNAME} ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USERNAME}
USER ${USERNAME}
ENV TERM=linux
# -----------------------------------------------------------------------------
# Wine
# Set Wine environment variables for headless operation
ENV WINEDEBUG=-all
ENV DISPLAY=:0
ENV XDG_RUNTIME_DIR=/tmp
# ENV WINEPREFIX=/home/${USERNAME}/.wine
# Create the Wine prefix (virtual Windows environment)
RUN wineboot --init
# -----------------------------------------------------------------------------
# Startup
WORKDIR /workspace
ENTRYPOINT ["/bin/bash", "-l", "-c"]
CMD ["/bin/bash", "-i"]