Commit ac573f33 by Madhan Neethiraj

ATLAS-3934: Dockerfile: moved environment variables to .env file - #3

parent 9a605b66
BUILD_HOST_SRC=true
SKIPTESTS=true
GIT_URL=https://github.com/apache/atlas.git
BRANCH=master
PROFILE=dist,berkeley-solr
ATLAS_VERSION=3.0.0-SNAPSHOT
......@@ -16,6 +16,7 @@
FROM atlas-base:latest
ARG ATLAS_VERSION
COPY ./scripts/atlas.sh ${ATLAS_SCRIPTS}/
COPY ./dist/apache-atlas-${ATLAS_VERSION}-bin.tar.gz /tmp/
......@@ -25,6 +26,8 @@ RUN tar xfz /tmp/apache-atlas-${ATLAS_VERSION}-bin.tar.gz --directory=/opt/ && \
rm -f /tmp/apache-atlas-${ATLAS_VERSION}-bin.tar.gz && \
mkdir -p /var/run/atlas && \
mkdir -p /var/log/atlas && \
rm -rf ${ATLAS_HOME}/logs && \
ln -s /var/log/atlas ${ATLAS_HOME}/logs && \
chown -R atlas:atlas ${ATLAS_HOME}/ /var/run/atlas/ /var/log/atlas/
ENTRYPOINT [ "/home/atlas/scripts/atlas.sh" ]
......@@ -17,8 +17,6 @@
FROM ubuntu:20.04
ENV ATLAS_VERSION 3.0.0-SNAPSHOT
# Install curl, wget, tzdata, Python, Java
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get -y install curl wget tzdata \
......
......@@ -27,10 +27,7 @@ ENV PATH /usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
# setup atlas group, and users
RUN mkdir -p /home/atlas/git && \
mkdir -p /home/atlas/.m2 && \
mkdir -p /home/atlas/scripts && \
mkdir -p /home/atlas/patches && \
mkdir -p /home/atlas/dist && \
chown -R atlas:atlas /home/atlas
chown -R atlas:atlas /home/atlas
COPY ./scripts/atlas-build.sh /home/atlas/scripts/
......
......@@ -27,52 +27,50 @@ Docker files in this folder create docker images and run them to build Apache At
2. Set this folder as your working directory.
3. Using docker-compose is the simpler way to build and deploy Apache Atlas in containers.
3. Update environment variables in .env file, if necessary
3.1. Execute following command to build Apache Atlas:
4. Using docker-compose is the simpler way to build and deploy Apache Atlas in containers.
4.1. Execute following command to build Apache Atlas:
docker-compose -f docker-compose.atlas-base.yml -f docker-compose.atlas-build.yml up
Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache.
3.2. Execute following command to install and start Atlas in a container:
4.2. Execute following command to install and start Atlas in a container:
docker-compose -f docker-compose.atlas-base.yml -f docker-compose.atlas.yml up -d
Apache Atlas will be installed at /opt/atlas/, and logs are at /opt/atlas/logs directory.
Apache Atlas will be installed at /opt/atlas/, and logs are at /var/logs/atlas directory.
4. Alternatively docker command can be used to build and deploy Apache Atlas.
5. Alternatively docker command can be used to build and deploy Apache Atlas.
4.1. Execute following command to build Docker image **atlas-base**:
5.1. Execute following command to build Docker image **atlas-base**:
docker build -f Dockerfile.atlas-base -t atlas-base .
This might take about 10 minutes to complete.
4.2. Execute following command to build Docker image **atlas-build**:
5.2. Execute following command to build Docker image **atlas-build**:
docker build -f Dockerfile.atlas-build -t atlas-build .
4.3. Build Apache Atlas in a container with one of the following commands:
# to build from a specific branch
docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v $(pwd)/scripts:/home/atlas/scripts -v $(pwd)/patches:/home/atlas/patches -v $(pwd)/dist:/home/atlas/dist -e BRANCH=master -e PROFILE=dist,berkeley-solr -e SKIPTESTS=true atlas-build
5.3. Build Apache Atlas in a container with one of the following commands:
# to build from local sources
docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v $(pwd)/scripts:/home/atlas/scripts -v $(pwd)/../..:/home/atlas/src:delegated -v $(pwd)/dist:/home/atlas/dist -e PROFILE=dist,berkeley-solr -e SKIPTESTS=true atlas-build
docker run -it --rm -v ${HOME}/.m2:/home/atlas/.m2:delegated -v $(pwd)/scripts:/home/atlas/scripts -v $(pwd)/../..:/home/atlas/src:delegated -v $(pwd)/patches:/home/atlas/patches -v $(pwd)/dist:/home/atlas/dist --env-file ./.env atlas-build
Time taken to complete the build might vary (upto an hour), depending on status of ${HOME}/.m2 directory cache.
4.4. Execute following command to build Docker image **atlas**:
5.4. Execute following command to build Docker image **atlas**:
docker build -f Dockerfile.atlas -t atlas .
docker build -f Dockerfile.atlas --build-arg ATLAS_VERSION=3.0.0-SNAPSHOT -t atlas .
This might take about 10 minutes to complete.
4.8. Execute following command to install and run Atlas services in a container:
5.8. Execute following command to install and run Atlas services in a container:
docker run -it -d --name atlas --hostname atlas.example.com -p 21000:21000 atlas
This might take few minutes to complete.
5. Atlas Admin can be accessed at http://localhost:21000 (admin/atlasR0cks!)
6. Atlas Admin can be accessed at http://localhost:21000 (admin/atlasR0cks!)
......@@ -7,6 +7,8 @@ services:
image: atlas-base
networks:
- atlas
environment:
- ATLAS_VERSION
networks:
atlas:
......@@ -20,9 +20,12 @@ services:
depends_on:
- atlas-base
environment:
BRANCH: 'master'
SKIPTESTS: 'true'
PROFILE: 'dist,berkeley-solr'
- ATLAS_VERSION
- BRANCH
- BUILD_HOST_SRC
- GIT_URL
- PROFILE
- SKIPTESTS
networks:
atlas:
......@@ -4,6 +4,8 @@ services:
build:
context: .
dockerfile: Dockerfile.atlas
args:
- ATLAS_VERSION=${ATLAS_VERSION}
image: atlas:latest
container_name: atlas
hostname: atlas.example.com
......@@ -15,6 +17,8 @@ services:
- "21000:21000"
depends_on:
- atlas-base
environment:
- ATLAS_VERSION
command:
- /home/atlas/scripts/atlas.sh
......
......@@ -38,12 +38,24 @@ else
ARG_SKIPTESTS="-DskipTests=${SKIPTESTS}"
fi
if [ "${BUILD_HOST_SRC}" == "" ]
then
BUILD_HOST_SRC=true
fi
export MAVEN_OPTS="-Xms2g -Xmx2g"
export M2=/home/atlas/.m2
if [ -f /home/atlas/src/pom.xml ]
if [ "${BUILD_HOST_SRC}" == "true" ]
then
if [ ! -f /home/atlas/src/pom.xml ]
then
echo "ERROR: BUILD_HOST_SRC=${BUILD_HOST_SRC}, but /home/atlas/src/pom.xml is not found "
exit 1
fi
echo "Building from /home/atlas/src"
cd /home/atlas/src
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment