created alpine fork

This commit is contained in:
Paul Wilde 2022-11-14 14:25:40 +00:00
parent 8ec39cb99d
commit 7198394146
7 changed files with 97 additions and 29 deletions

View file

@ -2,12 +2,11 @@
mkdir ./uploads ./static ./config -p mkdir ./uploads ./static ./config -p
chown -R 911:911 ./uploads
if [ ! -f ./script_config.sh ]; then if [ ! -f ./script_config.sh ]; then
cp ./script_config_sample.sh ./script_config.sh cp ./script_config_sample.sh ./script_config.sh
fi fi
podman pod create \ podman pod create \
--name rebased-pod \ --name rebased-pod \
-p 5000:5000 -p 5000:5000 \
-p 4000:4000

View file

@ -2,13 +2,5 @@
source ./script_config.sh source ./script_config.sh
if [ ! -d ./build ]; then podman build -f Containerfile --build-arg="BUILD_DATE=$DATE" --build-arg="VCS_REF=$REBASED_VER" -t $REBASED_IMG
git clone https://gitlab.com/soapbox-pub/rebased.git ./build
cd ./build
else
cd ./build
git pull
fi
podman build -f Dockerfile --build-arg="BUILD_DATE=$DATE" --build-arg="VCS_REF=$REBASED_VER" -t $REBASED_IMG

View file

@ -8,26 +8,17 @@ podman stop rebased-web
podman rm rebased-web podman rm rebased-web
echo Creating new 'rebased-web' container... echo Creating new 'rebased-web' container...
if [ ! -f ./config/prod.secret.exs ]; then
$conf=""
fi
podman run -d \ podman run -d \
--name rebased-web \ --name rebased-web \
--pod rebased-pod \ --pod rebased-pod \
-e DB_USER=$PG_USER \
-e DB_PASS=$PG_PASS \
-e DB_NAME=$PG_NAME \
-e DB_HOST=$PG_HOST \
-v ./uploads:/var/lib/pleroma/uploads:z \ -v ./uploads:/var/lib/pleroma/uploads:z \
-v ./static:/var/lib/pleroma/static:z \ -v ./static:/var/lib/pleroma/static:z \
-v ./config:/config:rw \
-v ./config:/var/lib/pleroma/config \ -v ./config:/var/lib/pleroma/config \
-v ./config/prod.secret.exs:/var/lib/pleroma/config.exs \ -v ./config/prod.secret.exs:/var/lib/pleroma/config.exs \
-e DOMAIN=social.example.com \
-e INSTANCE_NAME=rebased \
-e ADMIN_EMAIL=admin@example.com \
-e NOTIFY_EMAIL=notify@example.com \
-e DB_USER=rebased \
-e DB_PASS=rebased \
-e DB_NAME=rebased \
-e DB_HOST=localhost \
-e POSTGRES_HOST=localhost \
$REBASED_IMG $REBASED_IMG

View file

@ -2,7 +2,10 @@
source ./script_config.sh source ./script_config.sh
podman exec -it --user=0 --privileged rebased-web /opt/pleroma/bin/pleroma_ctl instance gen podman exec -it --user=0 rebased-web /opt/pleroma/bin/pleroma_ctl instance gen
echo "Check files in config - if all looks good rename generated_config.exs to prod.secret.exs" podman exec rebased-web cat /src/config/generated_config.exs > ./config/prod.secret.exs
echo .
echo =========================
echo "Check ./config/prod.secret.exs and if all looks OK, restart rebased-web container"

14
50-create-user.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
admin=""
echo "Username:"
read -r user
echo "Email:"
read -r email
echo "Make Admin? (y/N)"
read -r makeadmin
if [[ $makeadmin == "y" ]]; then
admin="--admin"
fi
podman exec -it rebased-web /opt/pleroma/bin/pleroma_ctl user new $user $email $admin
echo Done.

69
Containerfile Normal file
View file

@ -0,0 +1,69 @@
FROM elixir:1.14.1-alpine as build
ARG MIX_ENV=prod \
OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft slack github keycloak:ueberauth_keycloak_strategy"
WORKDIR /src
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
RUN apk update &&\
apk add git bash gcc g++ musl-dev make cmake file-dev \
exiftool imagemagick libmagic ncurses postgresql-client ffmpeg
RUN git clone https://gitlab.com/soapbox-pub/rebased.git /src
RUN mix local.hex --force &&\
mix local.rebar --force
RUN cd /src &&\
mix deps.get --only prod &&\
mkdir release &&\
mix release --path release
ARG BUILD_DATE
ARG VCS_REF
ENV TZ="Etc/UTC"
LABEL maintainer="hello@soapbox.pub" \
org.opencontainers.image.title="rebased" \
org.opencontainers.image.description="Rebased" \
org.opencontainers.image.authors="hello@soapbox.pub" \
org.opencontainers.image.vendor="soapbox.pub" \
org.opencontainers.image.documentation="https://gitlab.com/soapbox-pub/rebased" \
org.opencontainers.image.licenses="AGPL-3.0" \
org.opencontainers.image.url="https://soapbox.pub" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma
RUN apk add curl ca-certificates imagemagick libmagic ffmpeg postgresql-client elixir
RUN git clone https://github.com/facebookresearch/fastText.git ./fasttext &&\
cd fasttext && make && ls
RUN addgroup rebased &&\
adduser --system --shell /bin/false -G rebased --home ${HOME} rebased &&\
mkdir -p ${DATA}/uploads &&\
mkdir -p ${DATA}/static &&\
chown -R rebased ${DATA} &&\
mkdir -p /etc/pleroma &&\
chown -R rebased /etc/pleroma &&\
mkdir -p /usr/share/fasttext &&\
curl -L https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz -o /usr/share/fasttext/lid.176.ftz &&\
chmod 0644 /usr/share/fasttext/lid.176.ftz
RUN cp /src/fasttext/fasttext /usr/bin/fasttext
USER rebased
RUN cp -r /src/release/* ${HOME}
RUN cp /src/config/docker.exs /etc/pleroma/config.exs &&\
cp /src/docker-entrypoint.sh ${HOME}
RUN chown -R rebased ${HOME} ${DATA}
RUN chmod +x ${HOME}/docker-entrypoint.sh
EXPOSE 5000
ENTRYPOINT ["/opt/pleroma/docker-entrypoint.sh"]

View file

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
DATE=$(date +"%Y-%m-%d") DATE=$(date +"%Y-%m-%d")
PG_USER=pleroma PG_USER=rebased
PG_PASS=rebased PG_PASS=rebased
PG_HOST=localhost PG_HOST=localhost
PG_NAME=pleroma PG_NAME=rebased
REBASED_VER=develop REBASED_VER=develop
REBASED_IMG="rebased-$REBASED_VER-$DATE" REBASED_IMG="rebased-$REBASED_VER-$DATE"