Develop
This commit is contained in:
parent
7ca5f2d45a
commit
f901f203b0
302 changed files with 9897 additions and 10332 deletions
|
|
@ -1 +1 @@
|
|||
FROM docker.elastic.co/elasticsearch/elasticsearch:8.8.0
|
||||
FROM docker.elastic.co/elasticsearch/elasticsearch:8.8.1
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
FROM memcached:1.6.20-bullseye
|
||||
FROM memcached:1.6.21-bookworm
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
FROM postgres:15.3-bullseye
|
||||
FROM postgres:15.3-bookworm
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
FROM redis:7.0.11-bullseye
|
||||
FROM redis:7.0.11-bookworm
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
FROM zammad/zammad-docker-compose:5.4.1 AS builder
|
||||
ARG ZAMMAD_VERSION=6.0.0-32
|
||||
FROM zammad/zammad-docker-compose:${ZAMMAD_VERSION} AS builder
|
||||
RUN mkdir -p /opt/zammad/contrib/link/addons
|
||||
COPY addons ${ZAMMAD_TMP_DIR}/contrib/link/addons
|
||||
COPY setup.rb ${ZAMMAD_TMP_DIR}/contrib/link/setup.rb
|
||||
RUN sed -i '/proxy_set_header X-Forwarded-User "";/d' ${ZAMMAD_TMP_DIR}/contrib/nginx/zammad.conf;
|
||||
COPY addons ${ZAMMAD_DIR}/contrib/link/addons
|
||||
COPY setup.rb ${ZAMMAD_DIR}/contrib/link/setup.rb
|
||||
COPY install.rb ${ZAMMAD_DIR}/contrib/link/install.rb
|
||||
RUN sed -i '/proxy_set_header X-Forwarded-User "";/d' ${ZAMMAD_DIR}/contrib/nginx/zammad.conf;
|
||||
|
||||
USER root
|
||||
RUN set -ex; \
|
||||
|
|
@ -17,29 +19,30 @@ RUN git clone -b "${SEQUOIA_GIT_TAG}" --single-branch --depth 1 "${SEQUOIA_PROJE
|
|||
WORKDIR ${SEQUOIA_DIR}
|
||||
RUN export PATH=~/.cargo/bin:$PATH && cargo build -p sequoia-openpgp-ffi;
|
||||
|
||||
WORKDIR ${ZAMMAD_TMP_DIR}
|
||||
WORKDIR ${ZAMMAD_DIR}
|
||||
RUN echo "gem 'ruby_openpgp', git: 'https://github.com/throneless-tech/ruby_openpgp', branch: 'signing-and-userids'" >> Gemfile.local
|
||||
RUN echo "gem 'rails-observers'" >> Gemfile.local
|
||||
RUN bundle install --without test development mysql
|
||||
|
||||
RUN sed -i '/^[[:space:]]*# create install ready file/ i\
|
||||
echo "about to reinstall..."\n\
|
||||
bundle exec rails runner /opt/zammad/contrib/link/setup.rb\n\
|
||||
bundle exec rake zammad:package:migrate\n\
|
||||
bundle exec rake assets:precompile\n\
|
||||
' /docker-entrypoint.sh
|
||||
USER zammad
|
||||
RUN ZAMMAD_SAFE_MODE=1 bundle exec rails runner /opt/zammad/contrib/link/install.rb
|
||||
|
||||
FROM node:16.18.0-slim as node
|
||||
|
||||
FROM zammad/zammad-docker-compose:5.4.1
|
||||
FROM zammad/zammad-docker-compose:${ZAMMAD_VERSION}
|
||||
USER ${ZAMMAD_USER}
|
||||
ENV SEQUOIA_DIR=/usr/lib/sequoia
|
||||
ENV LD_LIBRARY_PATH=${SEQUOIA_DIR}/target/debug
|
||||
ENV ZAMMAD_READY_FILE=${ZAMMAD_DIR}/var/zammad.ready
|
||||
COPY --from=node /opt /opt
|
||||
COPY --from=node /usr/local/bin /usr/local/bin
|
||||
COPY --from=builder ${ZAMMAD_TMP_DIR} ${ZAMMAD_TMP_DIR}
|
||||
COPY --from=builder ${ZAMMAD_DIR} ${ZAMMAD_DIR}
|
||||
COPY --from=builder ${SEQUOIA_DIR} ${SEQUOIA_DIR}
|
||||
COPY --from=builder /usr/local/bundle /usr/local/bundle
|
||||
COPY --from=builder /docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN ZAMMAD_SAFE_MODE=1 bundle exec rake assets:precompile
|
||||
|
||||
|
||||
|
|
|
|||
77
docker/zammad/install.rb
Normal file
77
docker/zammad/install.rb
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
ROOT = '/opt/zammad'
|
||||
|
||||
def _read_file(file, fullpath: false)
|
||||
location = case fullpath
|
||||
when false
|
||||
"#{ROOT}/#{file}"
|
||||
when true
|
||||
file
|
||||
else
|
||||
"#{fullpath}/#{file}"
|
||||
end
|
||||
File.binread(location)
|
||||
end
|
||||
|
||||
def _write_file(file, permission, data)
|
||||
location = "#{ROOT}/#{file}"
|
||||
|
||||
# rename existing file if not already the same file
|
||||
if File.exist?(location)
|
||||
content_fs = _read_file(file)
|
||||
if content_fs == data
|
||||
puts { "NOTICE: file '#{location}' already exists, skip install" }
|
||||
return true
|
||||
end
|
||||
backup_location = "#{location}.save"
|
||||
puts "NOTICE: backup old file '#{location}' to #{backup_location}"
|
||||
File.rename(location, backup_location)
|
||||
end
|
||||
|
||||
# check if directories need to be created
|
||||
directories = location.split '/'
|
||||
(0..(directories.length - 2)).each do |position|
|
||||
tmp_path = ''
|
||||
(1..position).each do |count|
|
||||
tmp_path = "#{tmp_path}/#{directories[count]}"
|
||||
end
|
||||
|
||||
next if tmp_path == ''
|
||||
next if File.exist?(tmp_path)
|
||||
|
||||
Dir.mkdir(tmp_path, 0o755)
|
||||
end
|
||||
|
||||
# install file
|
||||
puts "NOTICE: install '#{location}' (#{permission})"
|
||||
file = File.new(location, 'wb')
|
||||
file.write(data)
|
||||
file.close
|
||||
File.chmod(permission.to_s.to_i(8), location)
|
||||
true
|
||||
end
|
||||
|
||||
def install(data)
|
||||
json = _read_file(data, fullpath: true)
|
||||
package = JSON.parse(json)
|
||||
package['files'].each do |file|
|
||||
permission = file['permission'] || '644'
|
||||
content = Base64.decode64(file['content'])
|
||||
_write_file(file['location'], permission, content)
|
||||
end
|
||||
end
|
||||
|
||||
def install_all
|
||||
packages = Dir.glob('/opt/zammad/contrib/link/addons/*')
|
||||
packages.each do |package|
|
||||
puts "Installing #{package} package..."
|
||||
install(package)
|
||||
puts 'Installed'
|
||||
rescue StandardError => e
|
||||
puts e.message
|
||||
end
|
||||
end
|
||||
|
||||
puts 'Installing packages...'
|
||||
install_all
|
||||
Loading…
Add table
Add a link
Reference in a new issue