Skip to content

Commit e71786f

Browse files
committed
Init
0 parents  commit e71786f

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM lubien/tired-proxy:2 as proxy
2+
FROM hexpm/elixir:1.12.3-erlang-24.1.4-debian-bullseye-20210902-slim
3+
4+
# install build dependencies
5+
RUN apt-get update -y && apt-get install -y build-essential git \
6+
&& apt-get clean && rm -f /var/lib/apt/lists/*_* \
7+
&& apt update \
8+
&& apt install curl --yes \
9+
&& apt-get install unzip -y \
10+
&& curl -fsSL https://code-server.dev/install.sh | sh
11+
12+
# prepare build dir
13+
WORKDIR /app
14+
15+
# Use bash shell
16+
ENV SHELL=/bin/bash
17+
18+
# Apply VS Code settings
19+
COPY settings.json /root/.local/share/code-server/User/settings.json
20+
21+
# Use our custom entrypoint script first
22+
COPY entrypoint.sh /entrypoint.sh
23+
24+
RUN curl -L https://fly.io/install.sh | sh \
25+
&& echo 'export FLYCTL_INSTALL="/root/.fly"' >> ~/.bashrc \
26+
&& echo 'export PATH="$FLYCTL_INSTALL/bin:$PATH"' >> ~/.bashrc \
27+
&& code-server --install-extension elixir-lsp.elixir-ls \
28+
&& code-server --install-extension FlyIoStaging.fly-extension
29+
30+
COPY --from=proxy /tired-proxy /tired-proxy
31+
32+
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
TIME_TO_SHUTDOWN="${IDLE_TIME_TO_SHUTDOWN:-120}"
4+
5+
mkdir -p /project
6+
7+
# In case fly volumes put something there
8+
rm -rf '/project/lost+found'
9+
10+
if [ -z "$(ls -A /project)" ]; then
11+
echo "Preparing project"
12+
13+
rm -rf /project
14+
git clone $GIT_REPO /project
15+
16+
cd /project
17+
18+
echo "Preparing README"
19+
20+
# We need to use a temporary file because `sh` does not
21+
# work properly rewritting files directly with `sed` not `tee`
22+
sed "s/\${FLY_CODE_URL}/https:\/\/${FLY_APP_NAME}.fly.dev/g" README.md | \
23+
sed "s/\${FLY_DEVELOPMENT_URL}/https:\/\/${FLY_APP_NAME}.fly.dev:4000/g" | \
24+
tee /tmp/README.md
25+
26+
mv /tmp/README.md /project/README.md
27+
28+
echo "Setting up Elixir environment"
29+
30+
mix local.hex --force
31+
mix local.rebar --force
32+
mix deps.get
33+
fi
34+
35+
code-server --bind-addr 0.0.0.0:9090 /project &
36+
/tired-proxy --port 8080 --host http://localhost:9090 --time $TIME_TO_SHUTDOWN

settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"workbench.colorTheme": "Default Dark+",
3+
"git.postCommitCommand": "sync",
4+
"git.enableSmartCommit": true,
5+
"git.confirmSync": false,
6+
"git.autofetch": true
7+
}

0 commit comments

Comments
 (0)