-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.sh
More file actions
executable file
·44 lines (36 loc) · 1.05 KB
/
docker.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.05 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
#!/usr/bin/env bash
set -e
docker_command() {
if [[ "$DOCKER_RUNNING" == "true" ]]; then
echo "Error: Already running inside container"
help
exit 1
fi
cleanup() {
rm .build-files/Dockerfile || true
rm .build-files/compose.yaml || true
rmdir .build-files || true
}
trap cleanup EXIT
mkdir .build-files
cat << EOF > .build-files/Dockerfile
FROM ubuntu
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y curl dotnet-sdk-8.0 python3 libatomic1 build-essential && dotnet workload install wasm-tools
RUN curl -fsSL https://deb.nodesource.com/setup_24.x -o nodesource_setup.sh && bash nodesource_setup.sh && rm nodesource_setup.sh && apt-get install nodejs -y
WORKDIR /code
EOF
cat << EOF > .build-files/compose.yaml
services:
dev:
build:
dockerfile: ./Dockerfile
environment:
- DOCKER_RUNNING=true
volumes:
- ../:/code
EOF
docker compose -f .build-files/compose.yaml build
docker compose -f .build-files/compose.yaml run --service-ports dev ${@:-bash}
}
docker_command "$@"