forked from github/plane
feat: monoimage
This commit is contained in:
parent
f3d05fda62
commit
585d9a1d1b
110
Dockerfile
Normal file
110
Dockerfile
Normal file
@ -0,0 +1,110 @@
|
||||
FROM git.orionkindel.com/tpl/asdf:bookworm AS system
|
||||
|
||||
ARG S6_OVERLAY_VERSION=3.1.6.2
|
||||
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
||||
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
zlib1g-dev \
|
||||
libncurses5-dev \
|
||||
libgdbm-dev \
|
||||
libnss3-dev \
|
||||
libssl-dev \
|
||||
libreadline-dev \
|
||||
libffi-dev \
|
||||
libsqlite3-dev \
|
||||
wget \
|
||||
libbz2-dev \
|
||||
uuid-dev \
|
||||
nginx \
|
||||
procps
|
||||
|
||||
RUN asdf plugin add nodejs \
|
||||
&& asdf plugin add python \
|
||||
&& asdf plugin add postgres
|
||||
|
||||
RUN --mount=type=cache,target=/.asdf-build \
|
||||
export ASDF_DOWNLOAD_PATH=/.asdf-build \
|
||||
&& export TMPDIR=/.asdf-build \
|
||||
&& export POSTGRES_SKIP_INITDB=y \
|
||||
&& asdf install nodejs 20.9.0 \
|
||||
&& asdf install python 3.11.1 \
|
||||
&& asdf install postgres 15.3
|
||||
|
||||
RUN asdf global nodejs 20.9.0 \
|
||||
&& asdf global postgres 15.3 \
|
||||
&& asdf global python 3.11.1
|
||||
|
||||
RUN useradd -m postgres && passwd -d postgres
|
||||
|
||||
ADD https://dl.min.io/server/minio/release/linux-amd64/minio /usr/bin
|
||||
RUN chmod +x /usr/bin/minio
|
||||
|
||||
RUN set -eo pipefail; \
|
||||
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg; \
|
||||
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb bookworm main" | tee /etc/apt/sources.list.d/redis.list; \
|
||||
apt-get update; \
|
||||
apt-get install -y redis
|
||||
|
||||
FROM system AS next_prebuild
|
||||
|
||||
RUN npm i -g yarn
|
||||
RUN --mount=type=cache,target=/.yarn-cache \
|
||||
yarn config set cache-folder /.yarn-cache
|
||||
|
||||
COPY package.json turbo.json yarn.lock app.json ./
|
||||
COPY packages packages
|
||||
COPY web web
|
||||
COPY space space
|
||||
|
||||
RUN --mount=type=cache,target=/.yarn-cache \
|
||||
yarn install
|
||||
|
||||
FROM next_prebuild AS next_build
|
||||
|
||||
RUN --mount=type=cache,target=/.yarn-cache \
|
||||
--mount=type=cache,target=/web/.next \
|
||||
--mount=type=cache,target=/space/.next \
|
||||
yarn build && \
|
||||
cp -R /web/.next /web/_next && \
|
||||
cp -R /space/.next /space/_next
|
||||
|
||||
RUN mv /web/_next /web/.next && \
|
||||
mv /space/_next /space/.next && \
|
||||
cp -R /web/.next/standalone/web/* /web/ && \
|
||||
cp -R /space/.next/standalone/space/* /space/
|
||||
|
||||
FROM next_build AS api_build
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
COPY apiserver apiserver
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
cd /apiserver \
|
||||
&& pip install -r requirements.txt --compile
|
||||
|
||||
FROM api_build AS s6
|
||||
|
||||
COPY docker/etc/ /etc/
|
||||
|
||||
RUN chmod -R 777 /root \
|
||||
&& chmod -R 777 /root/.asdf \
|
||||
&& chmod -x /root/.asdf/lib/commands/* \
|
||||
&& chmod -R 777 /apiserver \
|
||||
&& chmod -R 777 /web \
|
||||
&& chmod -R 777 /space \
|
||||
&& ln $(asdf which postgres) /usr/bin/postgres \
|
||||
&& ln $(asdf which initdb) /usr/bin/initdb \
|
||||
&& ln $(asdf which node) /usr/bin/node \
|
||||
&& ln $(asdf which npm) /usr/bin/npm \
|
||||
&& ln $(asdf which python) /usr/bin/python
|
||||
|
||||
ENV S6_KEEP_ENV=1
|
||||
ENTRYPOINT ["/init"]
|
36
docker/etc/nginx/nginx.conf
Normal file
36
docker/etc/nginx/nginx.conf
Normal file
@ -0,0 +1,36 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
root /www/data/;
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
client_max_body_size 5242880;
|
||||
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
add_header Permissions-Policy "interest-cohort=()" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3000/;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:8000/api/;
|
||||
}
|
||||
|
||||
location /spaces/ {
|
||||
rewrite ^/spaces/?$ /spaces/login break;
|
||||
proxy_pass http://localhost:3001/spaces/;
|
||||
}
|
||||
|
||||
location /uploads/ {
|
||||
proxy_pass http://localhost:9000/uploads/;
|
||||
}
|
||||
}
|
||||
}
|
2296
docker/etc/redis/redis.conf
Normal file
2296
docker/etc/redis/redis.conf
Normal file
File diff suppressed because it is too large
Load Diff
2
docker/etc/s6-overlay/s6-rc.d/api-beatworker/run
Normal file
2
docker/etc/s6-overlay/s6-rc.d/api-beatworker/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/bin/bash -lc 'cd /apiserver && /apiserver/bin/beat'
|
1
docker/etc/s6-overlay/s6-rc.d/api-beatworker/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/api-beatworker/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
2
docker/etc/s6-overlay/s6-rc.d/api-worker/run
Normal file
2
docker/etc/s6-overlay/s6-rc.d/api-worker/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/bin/bash -lc 'cd /apiserver && /apiserver/bin/worker'
|
1
docker/etc/s6-overlay/s6-rc.d/api-worker/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/api-worker/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
0
docker/etc/s6-overlay/s6-rc.d/api/dependencies.d/db
Normal file
0
docker/etc/s6-overlay/s6-rc.d/api/dependencies.d/db
Normal file
2
docker/etc/s6-overlay/s6-rc.d/api/run
Normal file
2
docker/etc/s6-overlay/s6-rc.d/api/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/bin/bash -lc 'cd /apiserver && /apiserver/bin/takeoff'
|
1
docker/etc/s6-overlay/s6-rc.d/api/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/api/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
2
docker/etc/s6-overlay/s6-rc.d/db/finish
Normal file
2
docker/etc/s6-overlay/s6-rc.d/db/finish
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/run/s6/basedir/bin/halt
|
26
docker/etc/s6-overlay/s6-rc.d/db/run
Normal file
26
docker/etc/s6-overlay/s6-rc.d/db/run
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
script=$(mktemp)
|
||||
chmod 777 "$script"
|
||||
|
||||
chmod -R 750 /pg_data
|
||||
chown -R postgres:postgres /pg_data
|
||||
|
||||
cat << "EOSH" > "$script"
|
||||
pgdir=/root/.asdf/installs/postgres/15.3
|
||||
|
||||
export POSTGRES_USER=plane
|
||||
export POSTGRES_PASSWORD=plane
|
||||
export POSTGRES_DB=plane
|
||||
export PGDATA=/pg_data
|
||||
export ROOT_DB_URL=postgresql://plane:plane@localhost:5432/postgres
|
||||
export TZ=GMT
|
||||
|
||||
pwfile=$(mktemp)
|
||||
echo -n $POSTGRES_PASSWORD > $pwfile
|
||||
|
||||
$pgdir/bin/initdb -U $POSTGRES_USER --pwfile=$pwfile --no-locale -L $pgdir/share/ || true
|
||||
$pgdir/bin/postgres -c 'max_connections=1000'
|
||||
EOSH
|
||||
|
||||
su postgres -c "/bin/bash $script"
|
1
docker/etc/s6-overlay/s6-rc.d/db/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/db/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
2
docker/etc/s6-overlay/s6-rc.d/minio/run
Normal file
2
docker/etc/s6-overlay/s6-rc.d/minio/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
/usr/bin/minio server /minio_data --console-address ":9090"
|
1
docker/etc/s6-overlay/s6-rc.d/minio/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/minio/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
2
docker/etc/s6-overlay/s6-rc.d/nginx/run
Normal file
2
docker/etc/s6-overlay/s6-rc.d/nginx/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
nginx -g "daemon off;"
|
1
docker/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
2
docker/etc/s6-overlay/s6-rc.d/redis/run
Normal file
2
docker/etc/s6-overlay/s6-rc.d/redis/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
/usr/bin/redis-server /etc/redis/redis.conf
|
1
docker/etc/s6-overlay/s6-rc.d/redis/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/redis/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
4
docker/etc/s6-overlay/s6-rc.d/spaces/run
Normal file
4
docker/etc/s6-overlay/s6-rc.d/spaces/run
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
HOSTNAME=127.0.0.1 \
|
||||
PORT=3001 \
|
||||
node /space/server.js space
|
1
docker/etc/s6-overlay/s6-rc.d/spaces/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/spaces/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/api
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/api
Normal file
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/api-worker
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/api-worker
Normal file
@ -0,0 +1 @@
|
||||
|
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/db
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/db
Normal file
@ -0,0 +1 @@
|
||||
|
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/minio
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/minio
Normal file
@ -0,0 +1 @@
|
||||
|
0
docker/etc/s6-overlay/s6-rc.d/user/contents.d/nginx
Normal file
0
docker/etc/s6-overlay/s6-rc.d/user/contents.d/nginx
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/redis
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/redis
Normal file
@ -0,0 +1 @@
|
||||
|
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/spaces
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/spaces
Normal file
@ -0,0 +1 @@
|
||||
|
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/web
Normal file
1
docker/etc/s6-overlay/s6-rc.d/user/contents.d/web
Normal file
@ -0,0 +1 @@
|
||||
|
5
docker/etc/s6-overlay/s6-rc.d/web/run
Normal file
5
docker/etc/s6-overlay/s6-rc.d/web/run
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
NEXT_PUBLIC_DEPLOY_URL="http://localhost/spaces" \
|
||||
HOSTNAME=127.0.0.1 \
|
||||
PORT=3000 \
|
||||
node /web/server.js web
|
1
docker/etc/s6-overlay/s6-rc.d/web/type
Normal file
1
docker/etc/s6-overlay/s6-rc.d/web/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
Loading…
Reference in New Issue
Block a user