Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopocarlini committed Nov 7, 2024
1 parent 0a988ed commit 186a33f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
69 changes: 35 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,50 @@
FROM ubuntu:latest
COPY . .

# Install dependencies
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y python3-pip
RUN apt-get install -y python3
RUN apt-get install -y nodejs
RUN apt-get install -y vim
RUN apt-get install -y curl
RUN apt-get install -y iputils-ping
RUN apt-get install -y postgresql-client
RUN apt-get install -y wget
RUN apt-get install -y libaio1t64
RUN apt-get install -y unzip
RUN rm -rf /var/lib/apt/lists/*


# Set environment variables for Oracle Instant Client
ENV ORACLE_HOME=/opt/oracle
ENV LD_LIBRARY_PATH=$ORACLE_HOME

# Define Oracle Instant Client download URLs

# Define the Oracle Instant Client download URLs
ENV BASIC_ZIP_URL="https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-basic-linux.x64-23.5.0.24.07.zip"
ENV SQLPLUS_ZIP_URL="https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-sqlplus-linux.x64-23.5.0.24.07.zip"

# Install dependencies in one RUN statement, clean up apt cache
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
nodejs \
vim \
curl \
iputils-ping \
postgresql-client \
wget \
libaio1 \
unzip && \
rm -rf /var/lib/apt/lists/*

# Download and set up Oracle Instant Client
# Download Oracle Instant Client files
RUN wget --no-check-certificate "${BASIC_ZIP_URL}" -O /tmp/instantclient-basic.zip && \
wget --no-check-certificate "${SQLPLUS_ZIP_URL}" -O /tmp/instantclient-sqlplus.zip && \
mkdir -p ${ORACLE_HOME} && \
unzip -q /tmp/instantclient-basic.zip -d /tmp/oracle_basic && \
unzip -q /tmp/instantclient-sqlplus.zip -d /tmp/oracle_sqlplus && \
mv /tmp/oracle_basic/instantclient_*/* ${ORACLE_HOME}/ && \
mv /tmp/oracle_sqlplus/instantclient_*/* ${ORACLE_HOME}/ && \
ln -s ${ORACLE_HOME}/instantclient ${ORACLE_HOME}/instantclient && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/*-linux-gnu/libaio.so.1 /usr/lib/libaio.so.1 && \
rm -rf /tmp/*

# Copy application files into the container
COPY . .
wget --no-check-certificate "${SQLPLUS_ZIP_URL}" -O /tmp/instantclient-sqlplus.zip

# Unzip and set up Oracle Instant Client
RUN mkdir -p ${ORACLE_HOME}
RUN unzip "/tmp/instantclient-basic.zip" -d /tmp/oracle_basic
RUN unzip "/tmp/instantclient-sqlplus.zip" -d /tmp/oracle_sqlplus
RUN mv /tmp/oracle_basic/instantclient_*/* ${ORACLE_HOME}/
RUN mv /tmp/oracle_sqlplus/instantclient_*/* ${ORACLE_HOME}/
RUN rm -rf /tmp
RUN ln -s ${ORACLE_HOME}/instantclient ${ORACLE_HOME}/instantclient
RUN ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus

RUN ln -s /usr/lib/*-linux-gnu/libaio.so.1t64 ${ORACLE_HOME}/libaio.so.1


# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -r requirements.txt --break-system-packages

# Expose the port the app runs on
EXPOSE 8080

# Set the entrypoint for the container
ENTRYPOINT ["python3", "./status.py"]
ENTRYPOINT ["python3", "./status.py"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ To build and run the Docker image locally, use the following commands:
docker build -t ubuntu-vm .
docker run -d -p 8080:8080 ubuntu-vm
```

If you use MAC with arm processor
```shell
docker buildx build --platform=linux/amd64 -t ubuntu-vm .
```

0 comments on commit 186a33f

Please sign in to comment.