Enhance: dockerfile(many) / Fix: docker run command as README /

docker-ignored: /.git/** & .DS_Store & npm-debug.log
This commit is contained in:
2025-12-19 22:15:00 +09:00
parent 3af5b5f87c
commit 58f82399ed
3 changed files with 28 additions and 25 deletions
+4 -1
View File
@@ -1,3 +1,6 @@
/README.md
/.env**
/.gitignore
/.gitignore
/.git/**
.DS_Store
npm-debug.log
+19 -21
View File
@@ -4,31 +4,29 @@ FROM --platform=$BUILDPLATFORM node:20-bullseye-slim
# Set working directory
WORKDIR /app
# Run as root
# Run as root & package install
USER root
RUN apt-get update && \
apt-get install -y \
build-essential \
python3 \
libsqlite3-dev && \
rm -rf /var/lib/apt/lists/*
# Install packages
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y python3
RUN apt-get install -y libsqlite3-dev
RUN rm -rf /var/lib/apt/lists/*
# Run as node
USER node
# Install deps
COPY --chown=node:node ./src/package*.json ./
RUN npm ci
# Copy source
COPY ./src ./
# Install dependencies
RUN npm ci --unsafe-perm
# Init replied_ids.json
COPY --chown=node:node ./src ./
RUN echo "[]" > replied_ids.json
# Copy entrypoint
COPY ./entrypoint.sh /app/docker-entrypoint.sh
RUN chmod +x /app/docker-entrypoint.sh
# entrypoint
COPY --chown=node:node ./entrypoint.sh /app/docker-entrypoint.sh
RUN sed -i 's/\r$//' /app/docker-entrypoint.sh && \
chmod +x /app/docker-entrypoint.sh
# Change line break
RUN sed -i 's/\r$//' /app/docker-entrypoint.sh
# Run
ENTRYPOINT ["/app/docker-entrypoint.sh"]
ENTRYPOINT ["/app/docker-entrypoint.sh"]
+5 -3
View File
@@ -7,13 +7,15 @@
### Use public image
```bash
touch memory.db
docker run -d --restart=always -v ./memory.db:/app/memory.db -e UWUZU_HOST=uwuzu.example.com -e UWUZU_TOKEN=APITOKEN -e TWEET_ENABLED=true -e CHECK_INTERVAL=300 -e THINK_OUTPUT_ENABLED=false --name rana gitea.last2014.com/last2014/rana-for-docker:latest
echo "[]" > replied_ids.json
docker run -d --restart=always -v ./memory.db:/app/memory.db -v ./replied_ids.json:/app/replied_ids.json -e UWUZU_HOST=uwuzu.example.com -e UWUZU_TOKEN=APITOKEN -e TWEET_ENABLED=true -e CHECK_INTERVAL=300 -e THINK_OUTPUT_ENABLED=false --name rana gitea.last2014.com/last2014/rana-for-docker:latest
```
で動きます。
/app/memory.dbが記憶になっているのでvolumesにしてください。
/app/memory.dbと/app/replied_ids.jsonが記憶になっているのでvolumesにしてください。
> **WARNING**
> [#3](https://gitea.last2014.com/last2014/rana-for-docker/issues/3)の通り`touch`コマンドをサボると起動できません。
> [#3](https://gitea.last2014.com/last2014/rana-for-docker/issues/3)の通り`touch`コマンドをサボると起動できません。
> また、echoをサボっても動きますが起動時にエラーが出ます。
> **WARNING**
>環境変数への値は`.env.example`を確認してください。