Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #4

Open
linus-ha opened this issue Jun 17, 2020 · 2 comments
Open

Dockerfile #4

linus-ha opened this issue Jun 17, 2020 · 2 comments

Comments

@linus-ha
Copy link

A dockerfile for the server to create a docker image which can be published on Docker Hub (as a GitHub action).

Are there any rough hints for compiling? I've never worked with maven before. Maybe the mvn-release-and-deploy.sh is helpful there?

I'm happy to help.

@linus-ha
Copy link
Author

linus-ha commented Jun 17, 2020

Okay, I've begun to understand how to build the server.

So here's what I've come up with:

FROM ubuntu:latest

LABEL maintainer="https://openestate.org/"
LABEL version="1.0.0"
LABEL description="A HSQLDB server for multi user installations of OpenEstate-ImmoTool"

# copy source
COPY . /app/OpenEstate-Tool-Server

## -- BUILD
# install maven
RUN apt update && apt install wget maven -y && apt-get clean
WORKDIR /app/OpenEstate-Tool-Server/
# bad quiqufix for commons-daemon-1.1.0
RUN wget "https://archive.apache.org/dist/commons/daemon/binaries/windows/commons-daemon-1.1.0-bin-windows.zip" -P /app/OpenEstate-Tool-Server/temp/commons-daemon/
RUN bash ./mvn-release-quick.sh

# copy package into root instead of installing package because of systemd
RUN cp -rf ./package/debian-amd64/OpenEstate-ImmoServer/* /

# clenaing up
WORKDIR /app
RUN rm -rf /app/OpenEstate-Tool-Server/

# DB dir
VOLUME [ "/var/lib/OpenEstate-ImmoServer/data" ]
# DB port
EXPOSE 9001

CMD [ "bash", "/opt/OpenEstate-ImmoServer/bin/Start.sh" ]

I would create a PR if #5 is fixed. Before that I wouldn't want to publish this.
systemd can't or shouldn't be used because it would ruin the approach of containerization in general.

Compare:
master...linus-ha:master

@pinhead84
Copy link
Contributor

Thanks for your feedback. The Dockerfile looks nice so far. Some thoughts about it:

  1. Is it necessary to build the application within the Dockerfile? Why not just download and extract the latest version from https://github.com/OpenEstate/OpenEstate-Tool-Server/releases/download/v1.0.0/OpenEstate-ImmoServer-1.0.0.linux-x86-64.tar.gz into /opt?

    This would make the build process easier, faster and Maven does not need to be installed via APT.

    In this case you only need to make sure, that environment variables are properly set before executing Start.sh:

    # Path to the folder, where the server log files are stored.
    RUN mkdir -p "/var/log/OpenEstate-ImmoServer"
    ENV SERVER_LOG_DIR "/var/log/OpenEstate-ImmoServer"
    
    # Path to the folder, where the server data files are stored.
    RUN mkdir -p "/var/lib/OpenEstate-ImmoServer"
    ENV SERVER_VAR_DIR "/var/lib/OpenEstate-ImmoServer"
    
    CMD [ "bash", "/opt/OpenEstate-ImmoServer/bin/Start.sh" ]
    
  2. Wouldn't it be useful to set the log folder as volume, too? - Also it might be useful to use /var/lib/OpenEstate-ImmoServer instead of /var/lib/OpenEstate-ImmoServer/data folder to make backups available?

    VOLUME [ "/var/lib/OpenEstate-ImmoServer", "/var/log/OpenEstate-ImmoServer" ]
    
  3. Maybe it would be nice, if the application's etc folder would be available externally. Otherwise it won't be possible to configure more then one database and to enable SSL encryption.

  4. Is FROM ubuntu:latest really necessary? - The application doesn't really need a full featured Ubuntu. Something like FROM debian:buster-slim would consume less disk space and would build faster. No further dependencies should be required (if the package is downloaded instead of build via Maven).

I'm not an expert in Docker - just used it for some smaller projects from time to time. So please let me know, what you think about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants