Skip to content

Commit 59d1238

Browse files
authored
Improve Linux dev setup (#2720)
1 parent 3648fb5 commit 59d1238

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

docker-compose.linux.override.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: '3.6'
2+
3+
# For Linux users.
4+
# Duplicate this file with the name "docker-compose.override.yml",
5+
# or create a symlink (ln -s docker-compose.linux.override.yml docker-compose.override.yml).
6+
# Adapt the uid/gid of the tmpfs mounts if needed.
7+
8+
x-aliases:
9+
- &linux_php_service
10+
# Fix owner/permissions on Linux
11+
entrypoint: /home/circleci/app/dockerfiles/dev/linux_entrypoint.sh
12+
user: "root:root"
13+
tmpfs: [ '/home/circleci/app/tmp:uid=1000,gid=1000,exec', '/home/circleci/app/tests/vendor:uid=1000,gid=1000,exec' ]
14+
15+
services:
16+
# --- Alpine ---
17+
'8.0-alpine': { <<: *linux_php_service }
18+
# --- Buster ---
19+
'7.0-buster': { <<: *linux_php_service }
20+
'7.1-buster': { <<: *linux_php_service }
21+
'7.2-buster': { <<: *linux_php_service }
22+
'7.3-buster': { <<: *linux_php_service }
23+
'7.4-buster': { <<: *linux_php_service }
24+
'8.0-buster': { <<: *linux_php_service }
25+
'8.1-buster': { <<: *linux_php_service }
26+
'8.2-buster': { <<: *linux_php_service }
27+
'8.3-buster': { <<: *linux_php_service }

dockerfiles/dev/linux_entrypoint.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
# set -x
4+
5+
WORKING_DIR=$(pwd)
6+
USER_ID=$(stat --format "%u" "${WORKING_DIR}")
7+
GROUP_ID=$(stat --format "%g" "${WORKING_DIR}")
8+
9+
if grep alpine /etc/os-release >& /dev/null; then
10+
apk --no-cache add shadow >& /dev/null
11+
fi
12+
13+
usermod -u "${USER_ID}" circleci
14+
groupmod -g "${GROUP_ID}" circleci
15+
16+
# It takes a few seconds, so let's do it in a sub-process to let the container start fast
17+
chown -R circleci:circleci /opt &
18+
19+
if [[ ! -f .tmp/gosu ]]; then
20+
mkdir -p .tmp
21+
curl -Lo .tmp/gosu "https://github.com/tianon/gosu/releases/download/1.17/gosu-amd64"
22+
chmod +x .tmp/gosu
23+
chown circleci:circleci -R .tmp
24+
fi
25+
26+
exec .tmp/gosu circleci "${@:-bash}"

0 commit comments

Comments
 (0)