Gui improvements and ideas
This commit is contained in:
parent
3f4c7d17bf
commit
2ae0b55e42
54 changed files with 639 additions and 237 deletions
85
Dockerfile
85
Dockerfile
|
|
@ -1,14 +1,19 @@
|
|||
FROM ruby:3.3
|
||||
|
||||
LABEL maintainer='david@hohl.cloud'
|
||||
|
||||
ARG NAME=app
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
ARG APP_PORT=3000
|
||||
|
||||
ARG INSTALL_DIR=/${NAME}
|
||||
|
||||
FROM ruby:3.3 AS development
|
||||
|
||||
ARG NAME
|
||||
ARG UID
|
||||
ARG GID
|
||||
ARG APP_PORT
|
||||
ARG INSTALL_DIR
|
||||
|
||||
LABEL maintainer='david@hohl.cloud'
|
||||
|
||||
WORKDIR ${INSTALL_DIR}
|
||||
|
||||
ENV GEM_HOME=${INSTALL_DIR}/.bundle
|
||||
|
|
@ -48,15 +53,75 @@ RUN \
|
|||
truncate -s 0 /var/log/*log && \
|
||||
gem update --system && \
|
||||
bundle config set app_config ${GEM_HOME}
|
||||
|
||||
USER ${NAME}
|
||||
|
||||
EXPOSE ${APP_PORT}
|
||||
FROM development AS builder
|
||||
|
||||
COPY Gemfile Gemfile.lock package.json yarn.lock ./
|
||||
|
||||
RUN bundle install && yarn install
|
||||
|
||||
FROM builder AS assets
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=builder /app/.bundle /app/.bundle
|
||||
COPY --from=builder /app/node_modules /app/node_modules
|
||||
|
||||
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 rails assets:precompile
|
||||
|
||||
FROM ruby:3.3.0-slim AS production
|
||||
|
||||
ARG NAME
|
||||
ARG UID
|
||||
ARG GID
|
||||
ARG APP_PORT
|
||||
ARG INSTALL_DIR
|
||||
|
||||
WORKDIR ${INSTALL_DIR}
|
||||
|
||||
ENV \
|
||||
LANG=C.UTF-8 \
|
||||
INSTALL_DIR=${INSTALL_DIR} \
|
||||
RAILS_ENV=production \
|
||||
TZ=Europe/Zurich \
|
||||
PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH
|
||||
|
||||
ENV GEM_HOME=${INSTALL_DIR}/.bundle
|
||||
|
||||
RUN \
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
|
||||
echo $TZ > /etc/timezone && \
|
||||
addgroup --gid ${GID} ${NAME} && \
|
||||
adduser \
|
||||
--gecos GECOS \
|
||||
--home /home/${NAME} \
|
||||
--uid ${UID} \
|
||||
--gid ${GID} \
|
||||
--disabled-password \
|
||||
--disabled-login \
|
||||
--shell /bin/bash \
|
||||
${NAME} && \
|
||||
apt-get update -yqq && \
|
||||
apt-get install -yqq --no-install-recommends \
|
||||
sqlite3 libvips && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||
truncate -s 0 /var/log/*log && \
|
||||
gem update --system && \
|
||||
bundle config set app_config ${GEM_HOME}
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT [ "bin/entrypoint" ]
|
||||
|
||||
ENV SERVER_PORT=$APP_PORT
|
||||
COPY . .
|
||||
|
||||
COPY --from=builder /app/.bundle /app/.bundle
|
||||
COPY --from=assets /app/public/assets /app/public/assets
|
||||
|
||||
RUN chown -R app:app /app/tmp /app/log /app/storage
|
||||
|
||||
USER app
|
||||
# Using variables in command list is not possible:
|
||||
# https://stackoverflow.com/questions/40454470/how-can-i-use-a-variable-inside-a-dockerfile-cmd
|
||||
CMD rails server --binding 0.0.0.0 --no-daemon --port $SERVER_PORT
|
||||
CMD [ "rails", "server", "--binding", "0.0.0.0", "--no-daemon", "--port" , "3000" ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue