docker: fix file permission problems.
Store the app in /home/danbooru/app instead of in /app so that we have permission to write inside the app dir. /app was owned by root, which prevented the danbooru user from writing to it.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
FROM ubuntu:20.04 AS build
|
FROM ubuntu:20.04 AS build
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
useradd --create-home danbooru && \
|
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
|
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
@@ -15,12 +14,10 @@ RUN \
|
|||||||
libvips-dev \
|
libvips-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
postgresql-server-dev-all && \
|
postgresql-server-dev-all && \
|
||||||
|
|
||||||
# webpacker expects the binary to be called `yarn`, but debian/ubuntu installs it as `yarnpkg`.
|
# webpacker expects the binary to be called `yarn`, but debian/ubuntu installs it as `yarnpkg`.
|
||||||
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
|
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /build
|
||||||
USER danbooru
|
|
||||||
|
|
||||||
COPY Gemfile Gemfile.lock ./
|
COPY Gemfile Gemfile.lock ./
|
||||||
RUN BUNDLE_DEPLOYMENT=true bundle install --jobs 4
|
RUN BUNDLE_DEPLOYMENT=true bundle install --jobs 4
|
||||||
@@ -39,7 +36,7 @@ RUN rm -rf node_modules log tmp && mkdir log tmp
|
|||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
useradd --create-home danbooru && \
|
useradd --create-home --user-group danbooru && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
|
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
|
||||||
ruby \
|
ruby \
|
||||||
@@ -49,11 +46,10 @@ RUN \
|
|||||||
libxml2 \
|
libxml2 \
|
||||||
postgresql-client
|
postgresql-client
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
USER danbooru
|
USER danbooru
|
||||||
|
WORKDIR /home/danbooru/app
|
||||||
|
COPY --from=build --chown=danbooru /build .
|
||||||
|
|
||||||
COPY --from=build /app .
|
VOLUME ["/home/danbooru/app/public/data"]
|
||||||
|
ENTRYPOINT ["./bin/rails"]
|
||||||
VOLUME ["/app/public/data"]
|
|
||||||
ENTRYPOINT ["/app/bin/rails"]
|
|
||||||
CMD ["server"]
|
CMD ["server"]
|
||||||
|
|||||||
Reference in New Issue
Block a user