Testing stuff with podman
This commit is contained in:
parent
6fb91d79f3
commit
167d936d53
6 changed files with 67 additions and 29 deletions
49
Dockerfile
49
Dockerfile
|
@ -1,10 +1,35 @@
|
||||||
FROM hexpm/elixir:1.15.4-erlang-26.0.2-alpine-3.18.2
|
##############################################
|
||||||
|
# BUILD CONTAINER
|
||||||
|
##############################################
|
||||||
|
|
||||||
|
FROM hexpm/elixir:1.16.0-erlang-26.2.1-alpine-3.18.4 as BUILD
|
||||||
|
|
||||||
ENV MIX_ENV=prod
|
ENV MIX_ENV=prod
|
||||||
|
|
||||||
|
RUN apk add git gcc g++ musl-dev make cmake file-dev exiftool ffmpeg imagemagick libmagic ncurses postgresql-client
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
ADD mix.exs mix.lock /src/
|
||||||
|
ADD ./restarter /src/restarter/
|
||||||
|
ADD ./priv /src/priv/
|
||||||
|
ADD ./installation /src/installation/
|
||||||
|
ADD ./rel /src/rel/
|
||||||
|
ADD ./config /src/config/
|
||||||
|
ADD ./docs /src/docs/
|
||||||
|
ADD ./lib /src/lib/
|
||||||
|
|
||||||
|
RUN mix local.hex --force && \
|
||||||
|
mix local.rebar --force
|
||||||
|
|
||||||
|
RUN mix deps.get --only=prod
|
||||||
|
|
||||||
|
RUN mix release --path /release
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# RUNTIME CONTAINER
|
||||||
|
#################################################
|
||||||
|
FROM alpine:3.18
|
||||||
ENV ERL_EPMD_ADDRESS=127.0.0.1
|
ENV ERL_EPMD_ADDRESS=127.0.0.1
|
||||||
|
|
||||||
ARG HOME=/opt/akkoma
|
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="akkoma" \
|
LABEL org.opencontainers.image.title="akkoma" \
|
||||||
org.opencontainers.image.description="Akkoma for Docker" \
|
org.opencontainers.image.description="Akkoma for Docker" \
|
||||||
org.opencontainers.image.vendor="akkoma.dev" \
|
org.opencontainers.image.vendor="akkoma.dev" \
|
||||||
|
@ -14,21 +39,11 @@ LABEL org.opencontainers.image.title="akkoma" \
|
||||||
org.opencontainers.image.revision=$VCS_REF \
|
org.opencontainers.image.revision=$VCS_REF \
|
||||||
org.opencontainers.image.created=$BUILD_DATE
|
org.opencontainers.image.created=$BUILD_DATE
|
||||||
|
|
||||||
RUN apk add git gcc g++ musl-dev make cmake file-dev exiftool ffmpeg imagemagick libmagic ncurses postgresql-client
|
RUN apk add ffmpeg imagemagick exiftool ncurses postgresql-client file-dev libmagic
|
||||||
|
|
||||||
|
COPY --from=BUILD /release /opt/akkoma/
|
||||||
|
ADD ./docker-entrypoint.sh /opt/akkoma/
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
|
|
||||||
ARG UID=1000
|
|
||||||
ARG GID=1000
|
|
||||||
ARG UNAME=akkoma
|
|
||||||
|
|
||||||
RUN addgroup -g $GID $UNAME
|
|
||||||
RUN adduser -u $UID -G $UNAME -D -h $HOME $UNAME
|
|
||||||
|
|
||||||
WORKDIR /opt/akkoma
|
WORKDIR /opt/akkoma
|
||||||
|
|
||||||
USER $UNAME
|
|
||||||
RUN mix local.hex --force &&\
|
|
||||||
mix local.rebar --force
|
|
||||||
|
|
||||||
CMD [ "/opt/akkoma/docker-entrypoint.sh" ]
|
CMD [ "/opt/akkoma/docker-entrypoint.sh" ]
|
|
@ -2,11 +2,9 @@ version: "3.7"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: akkoma-db:latest
|
image: postgres:14
|
||||||
build: ./docker-resources/database
|
|
||||||
shm_size: 4gb
|
shm_size: 4gb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
user: ${DOCKER_USER}
|
|
||||||
environment: {
|
environment: {
|
||||||
# This might seem insecure but is usually not a problem.
|
# This might seem insecure but is usually not a problem.
|
||||||
# You should leave this at the "akkoma" default.
|
# You should leave this at the "akkoma" default.
|
||||||
|
@ -21,16 +19,17 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- type: bind
|
- ./pgdata:/var/lib/postgresql/data:Z
|
||||||
source: ./pgdata
|
|
||||||
target: /var/lib/postgresql/data
|
|
||||||
|
|
||||||
akkoma:
|
akkoma:
|
||||||
image: akkoma:latest
|
image: akkoma:latest
|
||||||
build: .
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment: {
|
||||||
|
"AKKOMA_CONFIG_PATH": "/opt/akkoma/config/docker-config.exs"
|
||||||
|
}
|
||||||
links:
|
links:
|
||||||
- db
|
- db
|
||||||
ports: [
|
ports: [
|
||||||
|
@ -44,7 +43,9 @@ services:
|
||||||
"127.0.0.1:4000:4000",
|
"127.0.0.1:4000:4000",
|
||||||
]
|
]
|
||||||
volumes:
|
volumes:
|
||||||
- .:/opt/akkoma
|
- ./uploads:/opt/akkoma/uploads:Z
|
||||||
|
- ./instance:/opt/akkoma/instance:Z
|
||||||
|
- ./config/docker-config.exs:/opt/akkoma/config/docker-config.exs:Z
|
||||||
|
|
||||||
# Uncomment the following if you want to use a reverse proxy
|
# Uncomment the following if you want to use a reverse proxy
|
||||||
#proxy:
|
#proxy:
|
||||||
|
@ -60,3 +61,6 @@ services:
|
||||||
# - ./docker-resources/Caddyfile:/etc/caddy/Caddyfile
|
# - ./docker-resources/Caddyfile:/etc/caddy/Caddyfile
|
||||||
# - ./caddy-data:/data
|
# - ./caddy-data:/data
|
||||||
# - ./caddy-config:/config
|
# - ./caddy-config:/config
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db-data:
|
|
@ -8,7 +8,7 @@ while ! pg_isready -U ${DB_USER:-pleroma} -d postgres://${DB_HOST:-db}:5432/${DB
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "-- Running migrations..."
|
echo "-- Running migrations..."
|
||||||
mix ecto.migrate
|
/opt/akkoma/bin/pleroma_ctl migrate
|
||||||
|
|
||||||
echo "-- Starting!"
|
echo "-- Starting!"
|
||||||
mix phx.server
|
/opt/akkoma/bin/pleroma start
|
||||||
|
|
16
docker-resources/generate-instance
Executable file
16
docker-resources/generate-instance
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p ./uploads ./instance
|
||||||
|
|
||||||
|
podman run \
|
||||||
|
-v ./config:/opt/akkoma/config/:Z \
|
||||||
|
-v ./uploads:/opt/akkoma/uploads/:Z \
|
||||||
|
-v ./instance:/opt/akkoma/instance/:Z \
|
||||||
|
-it akkoma ./bin/pleroma_ctl instance gen \
|
||||||
|
--dbhost db \
|
||||||
|
--dbname akkoma \
|
||||||
|
--dbpass akkoma \
|
||||||
|
--dbuser akkoma \
|
||||||
|
--static-dir /opt/akkoma/instance/ \
|
||||||
|
--uploads-dir /opt/akkoma/uploads/ \
|
||||||
|
--listen-ip 0.0.0.0 $@
|
3
docker-resources/install-frontend
Normal file
3
docker-resources/install-frontend
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
podman compose run -e "PLEROMA_CTL_RPC_DISABLED=true" --rm akkoma ./bin/pleroma_ctl frontend install pleroma-fe --ref stable
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
docker compose run --rm akkoma $@
|
podman compose run -e "PLEROMA_CTL_RPC_DISABLED=true" --rm akkoma ./bin/pleroma_ctl $@
|
||||||
|
|
Loading…
Reference in a new issue