2019-02-14 12:59:59 +01:00
|
|
|
FROM ubuntu:xenial
|
|
|
|
LABEL maintainer="Andrey Antukh <niwi@niwi.nz>"
|
|
|
|
|
2019-02-14 22:20:31 +01:00
|
|
|
RUN set -ex; \
|
|
|
|
apt-get update && \
|
2019-02-14 12:59:59 +01:00
|
|
|
apt-get install -yq \
|
|
|
|
locales \
|
|
|
|
ca-certificates \
|
|
|
|
wget \
|
|
|
|
; \
|
|
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
|
|
apt-get update -yq && \
|
|
|
|
apt-get install -yq \
|
|
|
|
bash \
|
|
|
|
git \
|
|
|
|
vim \
|
|
|
|
openjdk-8-jdk \
|
|
|
|
rlwrap \
|
|
|
|
build-essential \
|
|
|
|
imagemagick \
|
|
|
|
webp \
|
|
|
|
sudo \
|
|
|
|
; \
|
|
|
|
mkdir -p /etc/resolvconf/resolv.conf.d; \
|
|
|
|
echo "nameserver 8.8.8.8" > /etc/resolvconf/resolv.conf.d/tail; \
|
|
|
|
apt-get update -yq; \
|
|
|
|
apt-get install -yq \
|
|
|
|
libbz2-dev liblzma-dev zlib1g-dev libfftw3-dev \
|
|
|
|
libfreetype6-dev libfontconfig1-dev libxt-dev \
|
|
|
|
libexif-dev libjpeg-dev libpng-dev libtiff-dev \
|
|
|
|
libwmf-dev libpango1.0-dev librsvg2-bin librsvg2-dev \
|
|
|
|
libxml2-dev libwebp-dev webp autoconf \
|
|
|
|
; \
|
|
|
|
git clone https://github.com/ImageMagick/ImageMagick.git imagemagick && \
|
|
|
|
cd imagemagick && \
|
|
|
|
git checkout -f 7.0.5-0 && \
|
|
|
|
./configure --prefix=/opt/img && \
|
|
|
|
make -j2 && \
|
|
|
|
make install && \
|
|
|
|
cd .. && \
|
2019-02-14 20:30:32 +01:00
|
|
|
rm -rf ./imagemagick
|
|
|
|
|
2019-02-14 22:20:31 +01:00
|
|
|
RUN set -ex; \
|
|
|
|
useradd -m -g users -s /bin/bash uxbox; \
|
2019-02-14 20:30:32 +01:00
|
|
|
passwd uxbox -d; \
|
|
|
|
echo "uxbox ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
|
|
|
|
|
|
USER uxbox
|
|
|
|
WORKDIR /home/uxbox
|
2019-02-14 12:59:59 +01:00
|
|
|
|
2019-02-14 21:55:07 +01:00
|
|
|
ENV NODE_VERSION=7.7.1
|
|
|
|
|
2019-02-14 13:47:19 +01:00
|
|
|
COPY ./scripts/lein /home/uxbox/.local/bin/lein
|
2019-02-14 22:20:31 +01:00
|
|
|
RUN set -ex; \
|
|
|
|
git clone https://github.com/creationix/nvm.git .nvm; \
|
2019-02-14 21:55:07 +01:00
|
|
|
bash -c "source .nvm/nvm.sh && nvm install $NODE_VERSION"; \
|
|
|
|
bash -c "source .nvm/nvm.sh && nvm alias default $NODE_VERSION"; \
|
|
|
|
bash -c "source .nvm/nvm.sh && nvm use default"; \
|
2019-02-14 20:30:32 +01:00
|
|
|
bash -c "/home/uxbox/.local/bin/lein version"
|
2019-02-14 12:59:59 +01:00
|
|
|
|
2019-02-14 21:55:07 +01:00
|
|
|
# add node and npm to path so the commands are available
|
|
|
|
ENV NVM_DIR /home/uxbox/.nvm
|
|
|
|
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
|
|
|
|
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
|
|
|
|
2019-02-14 12:59:59 +01:00
|
|
|
# Copy backend source and build release
|
2019-02-14 23:21:15 +01:00
|
|
|
COPY . /home/uxbox/backend
|
2019-02-14 22:20:31 +01:00
|
|
|
RUN set -ex; \
|
2019-02-14 22:45:14 +01:00
|
|
|
ls -l backend; \
|
2019-02-14 21:55:07 +01:00
|
|
|
bash -c "/home/uxbox/backend/scripts/dist"
|
2019-02-14 12:59:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Once application has been built, prepare production image
|
2019-02-14 20:30:32 +01:00
|
|
|
FROM openjdk:8-jre-alpine
|
2019-02-14 12:59:59 +01:00
|
|
|
|
|
|
|
LABEL maintainer="mathieu.brunot at monogramm dot io"
|
|
|
|
|
2019-02-14 20:30:32 +01:00
|
|
|
# Add uxbox as provided by builder
|
|
|
|
COPY --from=0 /home/uxbox/backend/dist/uxbox-backend.jar /srv/uxbox/app.jar
|
2019-02-14 12:59:59 +01:00
|
|
|
|
2019-02-14 20:30:32 +01:00
|
|
|
VOLUME /srv/uxbox/resources/public
|
2019-02-14 12:59:59 +01:00
|
|
|
|
2019-02-14 20:30:32 +01:00
|
|
|
WORKDIR /srv/uxbox/
|
2019-02-14 12:59:59 +01:00
|
|
|
|
2019-02-14 22:20:31 +01:00
|
|
|
RUN set -ex; \
|
|
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen; \
|
2019-02-14 20:30:32 +01:00
|
|
|
locale-gen && update-locale LANG=en_US.UTF-8 LC_ALL=C.UTF-8; \
|
|
|
|
mkdir -p /srv/uxbox/resources/public/media; \
|
|
|
|
mkdir -p /srv/uxbox/resources/public/static;
|
2019-02-14 12:59:59 +01:00
|
|
|
|
2019-02-14 22:45:14 +01:00
|
|
|
|
2019-02-14 12:59:59 +01:00
|
|
|
ENV \
|
|
|
|
# Locale setup
|
|
|
|
LANG=en_US.UTF-8 LC_ALL=C.UTF-8 \
|
2019-02-14 20:30:32 +01:00
|
|
|
# Application configuration
|
|
|
|
UXBOX_CONFIG=/srv/uxbox/config/application.properties \
|
2019-02-14 12:59:59 +01:00
|
|
|
# Security setup
|
|
|
|
UXBOX_SECRET=youshouldoverwritethiswithsomethingelse \
|
|
|
|
# Debug setup
|
|
|
|
UXBOX_DEBUG=false \
|
|
|
|
# STMP setup
|
|
|
|
UXBOX_SMTP_HOST=localhost \
|
|
|
|
UXBOX_SMTP_PORT=25 \
|
|
|
|
UXBOX_SMTP_USER=uxbox \
|
|
|
|
UXBOX_SMTP_PASSWORD=youshouldoverwritethiswithsomethingelse \
|
|
|
|
UXBOX_SMTP_SSL=false \
|
|
|
|
UXBOX_SMTP_TLS=false \
|
|
|
|
UXBOX_SMTP_ENABLED=false \
|
|
|
|
# Mail setup
|
|
|
|
UXBOX_MAIL_REPLY=no-reply@uxbox.io \
|
|
|
|
UXBOX_MAIL_FROM=no-reply@uxbox.io \
|
|
|
|
# Database setup
|
|
|
|
UXBOX_DB_TYPE=postgresql \
|
|
|
|
UXBOX_DB_USER=uxbox \
|
|
|
|
UXBOX_DB_PASSWORD=youshouldoverwritethiswithsomethingelse \
|
|
|
|
UXBOX_DB_NAME=uxbox \
|
|
|
|
UXBOX_DB_HOST=localhost \
|
|
|
|
UXBOX_DB_PORT=5432
|
|
|
|
|
|
|
|
EXPOSE 6060
|
|
|
|
|
2019-02-14 20:30:32 +01:00
|
|
|
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
|
|
|
CMD ["java", "-jar", "app.jar"]
|