Skip to content

Commit

Permalink
feat: add overmind, memogram, litestream
Browse files Browse the repository at this point in the history
Add overmind, memogram, and litestream to improve Telegram integration.

BREAKING CHANGE: Removed Memos 0.22.1, Litestream 0.3.13, and Overmind 2.4.0.
  • Loading branch information
hu3rror committed May 21, 2024
1 parent 491eaa0 commit 6809bce
Showing 1 changed file with 22 additions and 51 deletions.
73 changes: 22 additions & 51 deletions Dockerfile.memogram
Original file line number Diff line number Diff line change
@@ -1,82 +1,53 @@
# Set the Litestream image tag
ARG LITESTREAM_IMAGE_TAG=0.3.13
# Set the Memos image tag
ARG MEMOS_IMAGE_TAG=0.22.0

# Build Litestream
FROM docker.io/litestream/litestream:${LITESTREAM_IMAGE_TAG} AS litestream_upstream
# Set the entry point to an empty array
# Build litestream
FROM docker.io/litestream/litestream:${LITESTREAM_IMAGE_TAG} AS litestream_package
ENTRYPOINT []

# Build Memos
FROM ghcr.io/usememos/memos:${MEMOS_IMAGE_TAG} AS memos_upstream
# Set the entry point to an empty array
# Build memos
FROM ghcr.io/usememos/memos:${MEMOS_IMAGE_TAG} AS production
ENTRYPOINT []

# Final image
FROM ubuntu:latest as final
# Set the working directory to /usr/local/memos
WORKDIR /usr/local/memos

# Update apt and install necessary software
RUN apt-get update && apt-get install -y wget tzdata tmux curl bash
# Set the timezone to UTC
ENV TZ="UTC"

# Copy Memos to /usr/local/memos
COPY --from=memos_upstream /usr/local/memos/ /usr/local/memos/

# Copy Litestream to /usr/local/bin
COPY --from=litestream_upstream /usr/local/bin/litestream /usr/local/bin/litestream

# Set the target architecture
# Add Memogram
ARG TARGETARCH

# Download Memogram
ENV MEMOGRAM_TAG=0.1.1
RUN wget https://github.com/usememos/telegram-integration/releases/download/v${MEMOGRAM_TAG}/memogram_v${MEMOGRAM_TAG}_linux_${TARGETARCH}.tar.gz && \
RUN apk add --no-cache gcompat && \
wget https://github.com/usememos/telegram-integration/releases/download/v${MEMOGRAM_TAG}/memogram_v${MEMOGRAM_TAG}_linux_${TARGETARCH}.tar.gz && \
tar -xvf memogram_v${MEMOGRAM_TAG}_linux_${TARGETARCH}.tar.gz && \
rm memogram_v${MEMOGRAM_TAG}_linux_${TARGETARCH}.tar.gz README.md && \
chown root:root /usr/local/memos/memogram && \
chmod +x /usr/local/memos/memogram
chown root:root ./memogram && \
chmod +x ./memogram
# Copy Memogram environment file
COPY etc/memogram.env /usr/local/memos/.env

# Download overmind
# Add overmind
ENV OVERMIND_VERSION=2.5.1
RUN wget https://github.com/DarthSim/overmind/releases/download/v${OVERMIND_VERSION}/overmind-v${OVERMIND_VERSION}-linux-${TARGETARCH}.gz && \
gzip -d overmind-v${OVERMIND_VERSION}-linux-${TARGETARCH}.gz && \
mv overmind-v${OVERMIND_VERSION}-linux-${TARGETARCH} overmind && \
chmod +x overmind

# Copy Memogram environment file
COPY etc/memogram.env /usr/local/memos/.env
chown root:root ./overmind && \
chmod +x ./overmind
# Copy overmind configuration file
COPY etc/Procfile /usr/local/memos/Procfile

# Copy Litestream global configuration file
# Add litestream
COPY --from=litestream_package /usr/local/bin/litestream /usr/local/bin/litestream
# Copy litestream global configuration file
COPY etc/litestream.yml /etc/litestream.yml

# Copy memos script and make it executable
# Copy startup script and make it executable.
COPY scripts/run-memos-with-litestream.sh /usr/local/memos/run-memos-with-litestream.sh
RUN chmod +x /usr/local/memos/run-memos-with-litestream.sh
RUN chmod +x ./run-memos-with-litestream.sh

# Copy Memogram script and make it executable
COPY scripts/run-memogram.sh /usr/local/memos/run-memogram.sh
RUN chmod +x /usr/local/memos/run-memogram.sh

# Copy overmind configuration file
COPY etc/Procfile /usr/local/memos/Procfile

# Define environment variables
ENV DB_PATH="/var/opt/memos/memos_prod.db"

# Expose port 5230
EXPOSE 5230

# Create a directory to store data, which can be referenced as the mounting point
RUN mkdir -p /var/opt/memos
VOLUME /var/opt/memos

# Set Memos mode to "prod" and port to 5230
ENV MEMOS_MODE="prod"
ENV MEMOS_PORT="5230"

# Run Memos with Litestream (Default WORKDIR is `/usr/local/memos/`)
CMD ["./overmind", "start", "-f", "/usr/local/memos/Procfile"]
CMD ["./overmind", "start", "-f", "./Procfile"]

0 comments on commit 6809bce

Please sign in to comment.