-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
166 lines (150 loc) · 4.1 KB
/
Dockerfile
File metadata and controls
166 lines (150 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
FROM ghcr.io/actions/actions-runner:2.333.1
USER root
# Set shell with pipefail for better error handling
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Update and install base dependencies
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
# System build tools
autoconf \
automake \
build-essential \
libcurl4-openssl-dev \
libonig-dev \
libssl-dev \
libtool \
libxml2-dev \
libzip-dev \
m4 \
pkg-config \
zlib1g-dev \
# Git
git \
git-lfs \
gh \
# Node.js (installed via nodesource script)
nodejs \
# Python
python3 \
python3-pip \
# General utilities
curl \
openssh-client \
rsync \
software-properties-common \
unzip \
wget \
zip \
# Linters/Formatters
yamllint \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Add PHP repository and install PHP 8.1, 8.2, 8.3, 8.4, 8.5 and common extensions
RUN add-apt-repository -y ppa:ondrej/php \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
# PHP 8.1 with common extensions
php8.1 \
php8.1-cli \
php8.1-common \
php8.1-curl \
php8.1-gd \
php8.1-mbstring \
php8.1-mysqli \
php8.1-pdo-mysql \
php8.1-xml \
php8.1-zip \
php8.1-bcmath \
php8.1-opcache \
php8.1-intl \
# PHP 8.2 with common extensions
php8.2 \
php8.2-cli \
php8.2-common \
php8.2-curl \
php8.2-gd \
php8.2-mbstring \
php8.2-mysqli \
php8.2-pdo-mysql \
php8.2-xml \
php8.2-zip \
php8.2-bcmath \
php8.2-intl \
php8.2-opcache \
# PHP 8.3 with common extensions
php8.3 \
php8.3-cli \
php8.3-common \
php8.3-curl \
php8.3-gd \
php8.3-mbstring \
php8.3-mysqli \
php8.3-pdo-mysql \
php8.3-xml \
php8.3-zip \
php8.3-bcmath \
php8.3-intl \
php8.3-opcache \
# PHP 8.4 with common extensions
php8.4 \
php8.4-cli \
php8.4-common \
php8.4-curl \
php8.4-gd \
php8.4-mbstring \
php8.4-mysqli \
php8.4-pdo-mysql \
php8.4-xml \
php8.4-zip \
php8.4-bcmath \
php8.4-intl \
php8.4-opcache \
# PHP 8.5 with common extensions
php8.5 \
php8.5-cli \
php8.5-common \
php8.5-curl \
php8.5-gd \
php8.5-mbstring \
php8.5-mysqli \
php8.5-pdo-mysql \
php8.5-xml \
php8.5-zip \
php8.5-bcmath \
php8.5-intl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Configure PHP: Register all PHP versions and set php8.5 as default
RUN update-alternatives --install /usr/bin/php php /usr/bin/php8.1 81 \
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.2 82 \
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.3 83 \
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.4 84 \
&& update-alternatives --install /usr/bin/php php /usr/bin/php8.5 85 \
&& update-alternatives --set php /usr/bin/php8.5
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin \
--filename=composer \
&& chmod +x /usr/local/bin/composer
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf awscliv2.zip aws
# --- CONFIGURE NPM FOR GLOBAL INSTALLS AS NON-ROOT ---
# 1. Create a directory for global packages and set npm to use it
RUN mkdir -p /home/runner/.npm-global \
&& mkdir -p /home/runner/.npm
ENV NPM_CONFIG_PREFIX=/home/runner/.npm-global
# 2. Add the new global bin directory to the PATH
ENV PATH=$NPM_CONFIG_PREFIX/bin:$PATH
# --- END OF NPM CONFIGURATION ---
# Install global npm packages and AWS SAM CLI
RUN npm install -g yarn @redocly/cli typescript \
&& pip3 install --no-cache-dir --break-system-packages --ignore-installed blinker aws-sam-cli
# --- FIX PERMISSIONS ---
# After root has run npm, change ownership of the cache and global install
# directories to the runner user. This is the crucial step.
RUN chown -R runner:runner /home/runner/.npm /home/runner/.npm-global
USER runner