Skip to content

Commit

Permalink
Dockerfile Update (#11066)
Browse files Browse the repository at this point in the history
* Updating Dockerfile with multistage

* Updating reviewed changes

* Docker Development changes

* Docker workflow changes

* Arguments update

* Script path update

* Arguments update

* Resolving the reviewed suggestions
  • Loading branch information
Anuj359 authored and harshach committed Jun 28, 2023
1 parent 69f26a6 commit e8ab389
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/docker-openmetadata-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ jobs:
push_to_docker_hub:
runs-on: ubuntu-latest
env:
- name: Set build arguments
run: |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
DOCKER_RELEASE_TAG: ${{ github.event.inputs.DOCKER_RELEASE_TAG }}
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
needs: [release-project-event-workflow_dispatch, release-project-event-release]
Expand Down Expand Up @@ -156,3 +159,6 @@ jobs:
push: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
tags: ${{ steps.input_check.outputs.tags }}
file: ./docker/docker-compose-quickstart/Dockerfile
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
COMMIT_ID=${{ env.github.sha }}
30 changes: 20 additions & 10 deletions docker/development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM alpine:3
# Build stage
FROM alpine:3.15 AS build

EXPOSE 8585

RUN apk update \
&& apk upgrade \
&& apk add --update wget curl bash openjdk11 \
&& rm -rf /var/cache/apk/*
COPY docker/openmetadata-start.sh ./
COPY openmetadata-dist/target/openmetadata-*.tar.gz /
RUN tar zxvf openmetadata-*.tar.gz && \

RUN mkdir -p /opt/openmetadata && \
tar zxvf openmetadata-*.tar.gz -C /opt/openmetadata --strip-components 1 && \
rm openmetadata-*.tar.gz

# Final stage
FROM alpine:3.15

EXPOSE 8585

RUN apk add --update --no-cache bash openjdk11-jre

COPY --from=build /opt/openmetadata /opt/openmetadata
COPY docker/openmetadata-start.sh /

RUN chmod 777 openmetadata-start.sh
CMD ["./openmetadata-start.sh"]

WORKDIR /opt/openmetadata
ENTRYPOINT [ "/bin/bash" ]
CMD ["/openmetadata-start.sh"]
41 changes: 28 additions & 13 deletions docker/docker-compose-quickstart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM alpine:3

EXPOSE 8585
# Build stage
FROM alpine:3.15 AS build
ENV RELEASE_URL="https://github.com/open-metadata/OpenMetadata/releases/download/1.0.0-alpha-release/openmetadata-1.0.0-alpha.tar.gz"
RUN mkdir -p /opt/openmetadata && \
wget ${RELEASE_URL} && \
tar zxvf openmetadata-*.tar.gz -C /opt/openmetadata --strip-components 1 && \
rm openmetadata-*.tar.gz

RUN apk update \
&& apk upgrade \
&& apk add --update wget curl bash openjdk11 \
&& rm -rf /var/cache/apk/*
# Final stage
FROM alpine:3.15
ARG BUILD_DATE
ARG COMMIT_ID
LABEL maintainer="OpenMetadata"
LABEL org.open-metadata.image.authors="support@openmetadata.org"
LABEL org.open-metadata.vendor="OpenMetadata"
LABEL org.open-metadata.release-version="1.0.0-alpha"
LABEL org.open-metadata.description="OpenMetadata is an open source platform for metadata management and discovery."
LABEL org.open-metadata.url="https://open-metadata.org/"
LABEL org.open-metadata.vcs-url="https://github.com/open-metadata/OpenMetadata"
LABEL org.open-metadata.build-date=$BUILD_DATE
LABEL org.open-metadata.commit-id=$COMMIT_ID

COPY docker/openmetadata-start.sh docker/openmetadata.yaml ./
RUN wget https://github.com/open-metadata/OpenMetadata/releases/download/1.0.0-alpha-release/openmetadata-1.0.0-alpha.tar.gz && \
tar zxvf openmetadata-*.tar.gz && \
rm openmetadata-*.tar.gz
RUN chmod 777 openmetadata-start.sh
CMD ["./openmetadata-start.sh"]
EXPOSE 8585 8586
COPY docker/openmetadata-start.sh ./
COPY --from=build /opt/openmetadata /opt/openmetadata
RUN apk add --update --no-cache bash openjdk11-jre && \
chmod 777 openmetadata-start.sh
WORKDIR /opt/openmetadata
ENTRYPOINT [ "/bin/bash" ]
CMD ["/openmetadata-start.sh"]
1 change: 0 additions & 1 deletion docker/openmetadata-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# limitations under the License.

echo "Initializing OpenMetadata Server...";
cd /openmetadata-*/
echo "Migrating the database to the latest version and the indexes in ElasticSearch...";
./bootstrap/bootstrap_storage.sh migrate-all
echo " ||||||| "
Expand Down

0 comments on commit e8ab389

Please sign in to comment.