forked from treehouse/mastodon
Some Dockerfile improvements (#3182)
- improve docker_entrypoint.sh - serve static files with puma by default - sort packages list - use virtual package for build deps - show how to assign UID/GIDsignup-info-prompt
parent
ef900789bc
commit
ae78d012ac
|
@ -95,3 +95,8 @@ SMTP_FROM_ADDRESS=notifications@example.com
|
||||||
# Cluster number setting for streaming API server.
|
# Cluster number setting for streaming API server.
|
||||||
# If you comment out following line, cluster number will be `numOfCpuCores - 1`.
|
# If you comment out following line, cluster number will be `numOfCpuCores - 1`.
|
||||||
STREAMING_CLUSTER_NUM=1
|
STREAMING_CLUSTER_NUM=1
|
||||||
|
|
||||||
|
# Docker mastodon user
|
||||||
|
# If you use Docker, you may want to assign UID/GID manually.
|
||||||
|
# UID=1000
|
||||||
|
# GID=1000
|
||||||
|
|
27
Dockerfile
27
Dockerfile
|
@ -4,6 +4,7 @@ LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
||||||
description="A GNU Social-compatible microblogging server"
|
description="A GNU Social-compatible microblogging server"
|
||||||
|
|
||||||
ENV UID=991 GID=991 \
|
ENV UID=991 GID=991 \
|
||||||
|
RAILS_SERVE_STATIC_FILES=true \
|
||||||
RAILS_ENV=production NODE_ENV=production
|
RAILS_ENV=production NODE_ENV=production
|
||||||
|
|
||||||
EXPOSE 3000 4000
|
EXPOSE 3000 4000
|
||||||
|
@ -11,28 +12,28 @@ EXPOSE 3000 4000
|
||||||
WORKDIR /mastodon
|
WORKDIR /mastodon
|
||||||
|
|
||||||
RUN echo "@edge https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
|
RUN echo "@edge https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
|
||||||
&& BUILD_DEPS=" \
|
&& apk -U upgrade \
|
||||||
postgresql-dev \
|
&& apk add -t build-dependencies \
|
||||||
|
build-base \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
libxslt-dev \
|
libxslt-dev \
|
||||||
|
postgresql-dev \
|
||||||
|
protobuf-dev \
|
||||||
python \
|
python \
|
||||||
build-base \
|
&& apk add \
|
||||||
protobuf-dev" \
|
ca-certificates \
|
||||||
&& apk -U upgrade && apk add \
|
ffmpeg \
|
||||||
$BUILD_DEPS \
|
file \
|
||||||
nodejs@edge \
|
|
||||||
nodejs-npm@edge \
|
|
||||||
git \
|
git \
|
||||||
|
imagemagick@edge \
|
||||||
libpq \
|
libpq \
|
||||||
libxml2 \
|
libxml2 \
|
||||||
libxslt \
|
libxslt \
|
||||||
ffmpeg \
|
nodejs-npm@edge \
|
||||||
file \
|
nodejs@edge \
|
||||||
imagemagick@edge \
|
|
||||||
ca-certificates \
|
|
||||||
protobuf \
|
protobuf \
|
||||||
tini \
|
|
||||||
su-exec \
|
su-exec \
|
||||||
|
tini \
|
||||||
&& npm install -g npm@3 && npm install -g yarn \
|
&& npm install -g npm@3 && npm install -g yarn \
|
||||||
&& update-ca-certificates \
|
&& update-ca-certificates \
|
||||||
&& rm -rf /tmp/* /var/cache/apk/*
|
&& rm -rf /tmp/* /var/cache/apk/*
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
### 1. Adds local user (UID and GID are provided from environment variables).
|
||||||
|
### 2. Updates permissions, except for ./public/system (should be chown on previous installations).
|
||||||
|
### 3. Executes the command as that user.
|
||||||
|
|
||||||
|
echo "Creating mastodon user (UID : ${UID} and GID : ${GID})..."
|
||||||
addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon
|
addgroup -g ${GID} mastodon && adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon
|
||||||
|
|
||||||
|
echo "Updating permissions..."
|
||||||
find /mastodon -path /mastodon/public/system -prune -o -not -user mastodon -not -group mastodon -print0 | xargs -0 chown -f mastodon:mastodon
|
find /mastodon -path /mastodon/public/system -prune -o -not -user mastodon -not -group mastodon -print0 | xargs -0 chown -f mastodon:mastodon
|
||||||
su-exec mastodon:mastodon /sbin/tini -- "$@"
|
|
||||||
|
echo "Executing process..."
|
||||||
|
exec su-exec mastodon:mastodon /sbin/tini -- "$@"
|
||||||
|
|
Loading…
Reference in New Issue