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

Makelinuxinstallscript #20

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a99be99
strip binaries
costateixeira Jan 11, 2024
2060106
as is (dev/debug)
costateixeira Jan 12, 2024
c1bbc78
Update Dockerfile
costateixeira Jan 12, 2024
fe9ee9d
working
costateixeira Jan 12, 2024
1df8429
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Jan 13, 2024
01e9b64
delete old prebuilt inataller
costateixeira Jan 13, 2024
5ef7540
dlete debug script
costateixeira Jan 13, 2024
97ad860
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Jan 14, 2024
d903c8d
Create web.ini
costateixeira Jan 14, 2024
c56fd3b
add web.ini, optimize dockerfile
costateixeira Jan 14, 2024
29dd9da
Merge branch 'makelinuxinstallscript' of https://github.com/costateix…
costateixeira Jan 14, 2024
cbb80a7
CRLF again
costateixeira Jan 15, 2024
a213026
LF + fix dockerfile
costateixeira Jan 15, 2024
c0a4b2b
lf
costateixeira Jan 15, 2024
05a3a3f
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Jan 16, 2024
e8ec842
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Jan 16, 2024
cdc792f
working
costateixeira Jan 17, 2024
2f3c44d
Merge branch 'makelinuxinstallscript' of https://github.com/costateix…
costateixeira Jan 17, 2024
9655c01
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Jan 21, 2024
9da2670
update scripts
costateixeira Jan 21, 2024
ec96365
Merge branch 'makelinuxinstallscript' of https://github.com/costateix…
costateixeira Jan 21, 2024
71f2965
remove commented bits
costateixeira Jan 21, 2024
9a43a1a
remove unneeded script
costateixeira Jan 21, 2024
c6fc3c7
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Jan 31, 2024
cc03611
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Feb 7, 2024
a9f7cb2
Merge pull request #12 from HealthIntersections/master
costateixeira Feb 9, 2024
8d3587a
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Feb 15, 2024
ae7010b
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Mar 12, 2024
777205c
fix linux install scripts
costateixeira Apr 27, 2024
3f35c27
Merge pull request #13 from HealthIntersections/master
costateixeira Apr 27, 2024
64897b5
upgrade linux to 24.04
costateixeira Apr 27, 2024
aafbd4e
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira May 1, 2024
3679c0a
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira May 7, 2024
b140ae1
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira May 11, 2024
1afe9e0
Update linux-docker-build.yml
costateixeira May 19, 2024
221a529
Update linux-docker-build.yml
costateixeira May 19, 2024
5fcd8e2
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira May 20, 2024
a1fcac1
Update Dockerfile
costateixeira May 20, 2024
be93e8f
Update Dockerfile
costateixeira May 21, 2024
6d6e2db
Merge pull request #14 from HealthIntersections/master
costateixeira Aug 5, 2024
f126c6d
add some fixes
costateixeira Aug 6, 2024
3a092c1
clarify install options
costateixeira Aug 6, 2024
9c345db
minor update to dockerfile for doc
costateixeira Aug 10, 2024
1b94d54
Merge branch 'master' into makelinuxinstallscript
costateixeira Aug 18, 2024
382730f
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Aug 27, 2024
3f5a154
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Sep 6, 2024
a49bb2d
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Sep 7, 2024
701d5ce
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Sep 8, 2024
09c7505
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
costateixeira Sep 16, 2024
0d2eaa9
fix
costateixeira Sep 21, 2024
89b6475
Merge branch 'makelinuxinstallscript' of https://github.com/costateix…
costateixeira Sep 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions .github/workflows/linux-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
# but only for the main branch
push:
branches:
- master
# pull_request:
jobs:
Build-Docker-Image:
Expand Down Expand Up @@ -64,24 +63,24 @@ jobs:
mkdir -p ~/terminology/fhir-server
wget -q --no-clobber https://storage.googleapis.com/ig-build/snomed.test.cache -O ~/terminology/fhir-server/snomed.test.cache || true
ls ~/terminology/fhir-server/snomed.test.cache
- name: Run tests in docker
# - name: Run tests in docker
# run: |
# docker images --all
# docker run \
# --network gh \
# -v ~/terminology:/terminology \
# -v ~/test-settings.ini:/work/fhirserver/exec/64/test-settings.ini \
# fhirserver -tests

- name: Tag and push Docker image
run: |
docker images --all
docker run \
--network gh \
-v ~/terminology:/terminology \
-v ~/test-settings.ini:/work/fhirserver/exec/64/test-settings.ini \
fhirserver -tests
# Extract the FHIR server version from the library/version.inc file
FHIR_VERSION=$(grep -oP "FHIR_CODE_FULL_VERSION = '\K[^']+" library/version.inc)

# - name: Tag and push Docker image
# run: |
# # Extract the FHIR server version from the library/version.inc file
# FHIR_VERSION=$(grep -oP "FHIR_CODE_FULL_VERSION = '\K[^']+" library/version.inc)
#
# # Tag the Docker image with the extracted version and "latest"
# docker tag fhirserver ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:$FHIR_VERSION
# docker tag fhirserver ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:latest
#
# # Push both tagged images to Docker Hub
# docker push ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:$FHIR_VERSION
# docker push ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:latest
# Tag the Docker image with the extracted version and "latest"
docker tag fhirserver ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:$FHIR_VERSION
docker tag fhirserver ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:latest

# Push both tagged images to Docker Hub
docker push ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:$FHIR_VERSION
docker push ${{ secrets.DOCKERHUB_USERNAME }}/fhirserver:latest
148 changes: 117 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ubuntu:22.04 as builder
FROM ubuntu:24.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive


RUN apt update && apt install -y tzdata wget git unixodbc-dev libgtk2.0-dev xvfb sqlite3 libsqlite3-dev build-essential curl
RUN apt update && apt-get upgrade -y && apt install -y tzdata wget git unixodbc-dev libgtk2.0-dev xvfb sqlite3 libsqlite3-dev build-essential curl binutils && apt-get clean && rm -rf /var/lib/apt/lists/*

# Download and build OpenSSL 1.1.1w
WORKDIR /tmp
Expand All @@ -15,7 +15,7 @@ RUN wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz \
&& make test \
&& make install

RUN ls -la /usr/local/lib/
# RUN ls -la /usr/local/lib/

# Set the timezone
RUN echo "UTC" > /etc/timezone
Expand All @@ -36,40 +36,126 @@ RUN /work/bootstrap/linux-toolchain.sh /work/bootstrap
WORKDIR /work/fhirserver
COPY . /work/fhirserver

RUN /work/bootstrap/linux-libraries.sh /work/bootstrap
RUN cp /usr/local/lib/*.so* /usr/lib/
RUN /work/fhirserver/build/linux-fhirserver.sh /work/bootstrap
RUN cp exec/pack/*.properties exec/64
RUN /work/bootstrap/linux-libraries.sh /work/bootstrap && \
cp /usr/local/lib/*.so* /usr/lib/ && \
/work/fhirserver/build/linux-fhirserver.sh /work/bootstrap && \
cp exec/pack/*.properties exec/64
# RUN cp exec/install/* exec/64

RUN mkdir -p /work/fhirserver/exec/install/bin && \
mkdir -p /work/fhirserver/exec/install/x86_64 && \
mkdir -p /work/fhirserver/exec/install/content && \
mkdir -p /work/fhirserver/exec/install/config && \
# mkdir -p /work/fhirserver/exec/install/config/config && \
mkdir -p /work/fhirserver/exec/install/default_config && \
mkdir -p /work/fhirserver/exec/install/web

RUN cd /work/fhirserver && \
cp /work/fhirserver/exec/64/fhirserver /work/fhirserver/exec/install/bin && \
cp /work/fhirserver/exec/64/FHIRToolkit /work/fhirserver/exec/install/bin && \
cp /work/fhirserver/exec/64/FHIRConsole /work/fhirserver/exec/install/bin && \
cp /work/fhirserver/exec/pack/linux/*so* /work/fhirserver/exec/install/x86_64

RUN cp /work/fhirserver/exec/pack/linux/start.sh /work/fhirserver/exec/install/bin/start.sh && \
cp /work/fhirserver/exec/pack/linux/install.sh /work/fhirserver/exec/install && \
cp /work/fhirserver/exec/pack/linux/get-openssl.sh /work/fhirserver/exec/install && \
cp /tmp/openssl-1.1.1w/*.so* /work/fhirserver/exec/install/x86_64 && \
cp /work/fhirserver/exec/pack/*.properties /work/fhirserver/exec/install/content && \
cp /work/fhirserver/exec/pack/*.dat /work/fhirserver/exec/install/content && \

cp /work/fhirserver/exec/pack/fhirserver.cfg /work/fhirserver/exec/install/config && \
cp /work/fhirserver/exec/pack/web.ini /work/fhirserver/exec/install/config && \


cp /work/fhirserver/exec/pack/web.ini /work/fhirserver/exec/install/default_config && \
cp /work/fhirserver/exec/pack/fhirserver.cfg /work/fhirserver/exec/install/default_config && \
cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/default_config/config.ini && \
cp /work/fhirserver/config/config.json /work/fhirserver/exec/install/default_config/config.json && \
# cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/config.ini && \

# cp /work/fhirserver/config/config_bare.json /work/fhirserver/exec/install/default_config/config.json && \
# cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/default_config && \

mkdir -p /work/fhirserver/exec/install/web && \
cp -r /work/fhirserver/server/web/* /work/fhirserver/exec/install/web && \
cd /work/fhirserver/exec && tar -czvf ./install.tgz ./install/ && ls -la /work/fhirserver/exec


# Set the health check
HEALTHCHECK --interval=1m --timeout=10s --retries=5 \
HEALTHCHECK --interval=1m --timeout=10s --retries=5 \
CMD curl -f http://localhost:${PORT}/fhir/metadata || exit 1

# Set the environment variables
ENV DISPLAY :99
ENV PORT 80
ENV TERMINOLOGY_CACHE /terminology
ENV DISPLAY=:99
ENV PORT=80
ENV TERMINOLOGY_CACHE=/terminology
VOLUME /terminology

ENV DEBIAN_FRONTEND=

RUN printf '#!/bin/bash \n\
set -e \n\
start_xvfb() { \n\
Xvfb :99 -screen 0 1024x768x8 -nolisten tcp & \n\
} \n\
stop_xvfb() { \n\
killall Xvfb || true \n\
} \n\
trap stop_xvfb SIGTERM \n\
rm -f /tmp/.X99-lock \n\
start_xvfb \n\
echo "[web]" > /work/fhirserver/exec/64/web.ini; \n\
echo "http=${PORT}" >> /work/fhirserver/exec/64/web.ini; \n\
/work/fhirserver/exec/64/fhirserver $(eval echo "$@")' > /bin/entrypoint.sh && \
chmod +x /bin/entrypoint.sh


ENTRYPOINT ["/bin/entrypoint.sh"]

CMD ["-cmd", "exec", "-cfg", "/config/config.ini", "-local", "$TERMINOLOGY_CACHE"]
# ENTRYPOINT ["/bin/entrypoint.sh"]

# CMD ["-cmd", "exec", "-cfg", "/config/config.ini", "-local", "$TERMINOLOGY_CACHE"]



# Runtime stage
FROM ubuntu:24.04 AS runtime

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Set up environment variables
# ENV HOME=~/
ENV DISPLAY=:99
ENV PORT=80
ENV TERMINOLOGY_CACHE=/var/cache/txcache

# Install runtime dependencies
RUN apt-get update && apt-get upgrade -y && apt-get install -y wget tzdata xvfb libgtk2.0-0 libsqlite3-dev curl && apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p $HOME/fhirserver/config $TERMINOLOGY_CACHE /fhirserver \
&& chmod -R 777 $TERMINOLOGY_CACHE \
&& chmod -R 777 /fhirserver

# Copy necessary files from the builder stage
COPY --from=builder /work/fhirserver/exec/install.tgz /fhirserver/install.tgz

# RUN cd /fhirserver \
# && tar -xzvf install.tgz \
# && cd ./install \
# && ./install.sh > install.log 2>&1

# Assuming /fhirserver is your working directory
WORKDIR /fhirserver

# Extract the contents of the tar file
RUN tar -xzvf install.tgz

# Change working directory to the extracted folder
WORKDIR /fhirserver/install


### Choose your flavour / uncomment one of the following lines ###:
##
##

# 1. Run the installation script for a blank, clean install
RUN chmod a+x ./install.sh && ./install.sh

# OR

# 2. Run the installation script With Zero Config as tx.fhir.org
# RUN chmod a+x ./install.sh && ./install.sh -nodaemon -zero=https://storage.googleapis.com/tx-fhir-org/config.json

##
##
##
####################################################################

WORKDIR /root/fhirserver

# Define entrypoint and command
CMD ["bash", "-c", "cd ~/fhirserver/ && ./start.sh"]

# Expose the necessary port
EXPOSE 80
152 changes: 152 additions & 0 deletions Dockerfile prev
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
FROM ubuntu:22.04 as builder

ENV DEBIAN_FRONTEND=noninteractive


RUN apt update && apt install -y tzdata wget git unixodbc-dev libgtk2.0-dev xvfb sqlite3 libsqlite3-dev build-essential curl binutils

# Download and build OpenSSL 1.1.1w
WORKDIR /tmp
RUN wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz \
&& tar -xf openssl-1.1.1w.tar.gz \
&& cd openssl-1.1.1w \
&& ./config \
&& make \
&& make test \
&& make install

RUN ls -la /usr/local/lib/

# Set the timezone
RUN echo "UTC" > /etc/timezone

RUN cd /tmp && \
wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit.tar.gz && \
tar -xzvf mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit.tar.gz && \
cp -r mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit/lib/* /usr/local/lib && \
cp -r mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit/bin/* /usr/local/bin && \
rm -rf mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit && \
rm -rf mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit.tar.gz && \
myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so" && \
myodbc-installer -a -d -n "MySQL ODBC 8.0" -t "Driver=/usr/local/lib/libmyodbc8a.so"

COPY build/linux-toolchain.sh build/linux-libraries.sh /work/bootstrap/
RUN /work/bootstrap/linux-toolchain.sh /work/bootstrap

WORKDIR /work/fhirserver
COPY . /work/fhirserver

RUN /work/bootstrap/linux-libraries.sh /work/bootstrap
RUN cp /usr/local/lib/*.so* /usr/lib/
RUN /work/fhirserver/build/linux-fhirserver.sh /work/bootstrap
RUN cp exec/pack/*.properties exec/64
# RUN cp exec/install/* exec/64

RUN mkdir -p /work/fhirserver/exec/install/bin
RUN mkdir -p /work/fhirserver/exec/install/x86_64
RUN mkdir -p /work/fhirserver/exec/install/content
RUN mkdir -p /work/fhirserver/exec/install/config
RUN mkdir -p /work/fhirserver/exec/install/config/config
RUN mkdir -p /work/fhirserver/exec/install/web

RUN cd /work/fhirserver
RUN cp /work/fhirserver/exec/64/fhirserver /work/fhirserver/exec/install/bin
RUN cp /work/fhirserver/exec/64/FHIRToolkit /work/fhirserver/exec/install/bin
RUN cp /work/fhirserver/exec/64/FHIRConsole /work/fhirserver/exec/install/bin
RUN cp /work/fhirserver/exec/pack/linux/*so* /work/fhirserver/exec/install/x86_64
RUN cp /work/fhirserver/exec/pack/linux/start.sh /work/fhirserver/exec/install/bin
RUN cp /work/fhirserver/exec/pack/linux/install.sh /work/fhirserver/exec/install
RUN cp /work/fhirserver/exec/pack/linux/get-openssl.sh /work/fhirserver/exec/install
RUN cp /tmp/openssl-1.1.1w/*.so* /work/fhirserver/exec/install/x86_64
RUN cp /work/fhirserver/exec/pack/*.properties /work/fhirserver/exec/install/content
RUN cp /work/fhirserver/exec/pack/*.dat /work/fhirserver/exec/install/content
RUN cp /work/fhirserver/exec/pack/fhirserver.cfg /work/fhirserver/exec/install/config
RUN cp /work/fhirserver/exec/64/web.ini /work/fhirserver/exec/install/config
RUN cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/config
RUN mkdir -p /work/fhirserver/exec/install/web
RUN cp -r /work/fhirserver/server/web/* /work/fhirserver/exec/install/web

RUN cd /work/fhirserver/exec && tar -czvf ./install.tgz ./install/ && ls -la /work/fhirserver/exec


# Set the health check
HEALTHCHECK --interval=1m --timeout=10s --retries=5 \
CMD curl -f http://localhost:${PORT}/fhir/metadata || exit 1

# Set the environment variables
ENV DISPLAY :99
ENV PORT 80
ENV TERMINOLOGY_CACHE /terminology
VOLUME /terminology

ENV DEBIAN_FRONTEND=

RUN printf '#!/bin/bash \n\
set -e \n\
start_xvfb() { \n\
Xvfb :99 -screen 0 1024x768x8 -nolisten tcp & \n\
} \n\
stop_xvfb() { \n\
killall Xvfb || true \n\
} \n\
trap stop_xvfb SIGTERM \n\
rm -f /tmp/.X99-lock \n\
start_xvfb \n\
echo "[web]" > /work/fhirserver/exec/64/web.ini; \n\
echo "http=${PORT}" >> /work/fhirserver/exec/64/web.ini; \n\
/work/fhirserver/exec/64/fhirserver $(eval echo "$@")' > /bin/entrypoint.sh && \
chmod +x /bin/entrypoint.sh


# ENTRYPOINT ["/bin/entrypoint.sh"]

# CMD ["-cmd", "exec", "-cfg", "/config/config.ini", "-local", "$TERMINOLOGY_CACHE"]



# Runtime stage
FROM ubuntu:22.04 as runtime

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Set up environment variables
# ENV HOME=~/
ENV DISPLAY=:99
ENV PORT=80
ENV TERMINOLOGY_CACHE=/var/cache/txcache

# Install runtime dependencies
RUN apt-get update && apt-get install -y wget tzdata xvfb libgtk2.0-0 libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p $HOME/fhirserver/config $TERMINOLOGY_CACHE /fhirserver \
&& chmod -R 777 $TERMINOLOGY_CACHE \
&& chmod -R 777 /fhirserver

# Copy necessary files from the builder stage
COPY --from=builder /work/fhirserver/exec/install.tgz /fhirserver/install.tgz

# RUN cd /fhirserver \
# && tar -xzvf install.tgz \
# && cd ./install \
# && ./install.sh > install.log 2>&1

# Assuming /fhirserver is your working directory
WORKDIR /fhirserver

# Extract the contents of the tar file
RUN tar -xzvf install.tgz

# Change working directory to the extracted folder
WORKDIR /fhirserver/install

# Run the installation script
RUN ./install.sh -nodaemon
# -zero=https://storage.googleapis.com/tx-fhir-org/config.json
### Uncomment and append this line above to the install script, to allow the initial tx config to be loaded


# Define entrypoint and command
CMD ["bash", "-c", "cd ~/fhirserver/ && ./start.sh"]

# Expose the necessary port
EXPOSE 80
Binary file added FastMM4_AVX512.obj
Binary file not shown.
1 change: 1 addition & 0 deletions build/linux-fhirserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ $BUILD/tools/lazarus/lazbuild toolkit2/fhirtoolkit.lpr --build-mode=linux -q -q
echo "## compile server"
$BUILD/tools/lazarus/lazbuild server/fhirserver.lpr --build-mode=linux -q -q --build-all

find ./exec/64 -type f ! -name "*.*" -exec strip {} \;
3 changes: 2 additions & 1 deletion config/config.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[config]
zero=https://storage.googleapis.com/tx-fhir-org
zero=file:/root/fhirserver/default_config
version=*
local=/var/cache/txcache
user=gg

[web]
Loading
Loading