Skip to content

Commit

Permalink
slim docker images
Browse files Browse the repository at this point in the history
# Conflicts:
#	apollo-adminservice/src/main/docker/Dockerfile
#	apollo-configservice/src/main/docker/Dockerfile
#	apollo-portal/src/main/docker/Dockerfile
  • Loading branch information
fuquan.jiang authored and nobodyiam committed Feb 27, 2021
1 parent 0a7b760 commit aa4c3a9
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 24 deletions.
3 changes: 3 additions & 0 deletions apollo-adminservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
</imageTags>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<serverId>docker-hub</serverId>
<buildArgs>
<VERSION>${project.version}</VERSION>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
Expand Down
28 changes: 20 additions & 8 deletions apollo-adminservice/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@
# 3. Run with: docker run -p 8090:8090 -e SPRING_DATASOURCE_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8" -e SPRING_DATASOURCE_USERNAME=FillInCorrectUser -e SPRING_DATASOURCE_PASSWORD=FillInCorrectPassword -d -v /tmp/logs:/opt/logs --name apollo-adminservice apolloconfig/apollo-adminservice

FROM openjdk:8-jre-alpine
MAINTAINER ameizi <[email protected]>
LABEL maintainer="[email protected];ameizi<[email protected]>"

RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk update upgrade \
&& apk add --no-cache unzip

ARG VERSION
ENV VERSION $VERSION

COPY apollo-adminservice-${VERSION}-github.zip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip

RUN unzip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip -d /apollo-adminservice \
&& rm -rf /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip \
&& chmod +x /apollo-adminservice/scripts/startup.sh

FROM openjdk:8-jre-alpine
LABEL maintainer="[email protected];ameizi<[email protected]>"

ENV APOLLO_RUN_MODE "Docker"
ENV VERSION 1.9.0-SNAPSHOT
ENV SERVER_PORT 8090

RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk update upgrade \
&& apk add --no-cache procps unzip curl bash tzdata \
&& apk add --no-cache procps curl bash tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone

ADD apollo-adminservice-${VERSION}-github.zip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip

RUN unzip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip -d /apollo-adminservice \
&& rm -rf /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip \
&& chmod +x /apollo-adminservice/scripts/startup.sh
COPY --from=0 /apollo-adminservice /apollo-adminservice

EXPOSE $SERVER_PORT

Expand Down
3 changes: 3 additions & 0 deletions apollo-configservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@
</imageTags>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<serverId>docker-hub</serverId>
<buildArgs>
<VERSION>${project.version}</VERSION>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
Expand Down
28 changes: 20 additions & 8 deletions apollo-configservice/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@
# 3. Run with: docker run -p 8080:8080 -e SPRING_DATASOURCE_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8" -e SPRING_DATASOURCE_USERNAME=FillInCorrectUser -e SPRING_DATASOURCE_PASSWORD=FillInCorrectPassword -d -v /tmp/logs:/opt/logs --name apollo-configservice apolloconfig/apollo-configservice

FROM openjdk:8-jre-alpine
MAINTAINER ameizi <[email protected]>
LABEL maintainer="[email protected];ameizi<[email protected]>"

RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk update upgrade \
&& apk add --no-cache unzip

ARG VERSION
ENV VERSION $VERSION

COPY apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-configservice-${VERSION}-github.zip

RUN unzip /apollo-configservice/apollo-configservice-${VERSION}-github.zip -d /apollo-configservice \
&& rm -rf /apollo-configservice/apollo-configservice-${VERSION}-github.zip \
&& chmod +x /apollo-configservice/scripts/startup.sh

FROM openjdk:8-jre-alpine
LABEL maintainer="[email protected];ameizi<[email protected]>"

ENV APOLLO_RUN_MODE "Docker"
ENV VERSION 1.9.0-SNAPSHOT
ENV SERVER_PORT 8080

RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk update upgrade \
&& apk add --no-cache procps unzip curl bash tzdata \
&& apk add --no-cache procps curl bash tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone

ADD apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-configservice-${VERSION}-github.zip

RUN unzip /apollo-configservice/apollo-configservice-${VERSION}-github.zip -d /apollo-configservice \
&& rm -rf /apollo-configservice/apollo-configservice-${VERSION}-github.zip \
&& chmod +x /apollo-configservice/scripts/startup.sh
COPY --from=0 /apollo-configservice /apollo-configservice

EXPOSE $SERVER_PORT

Expand Down
3 changes: 3 additions & 0 deletions apollo-portal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
</imageTags>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<serverId>docker-hub</serverId>
<buildArgs>
<VERSION>${project.version}</VERSION>
</buildArgs>
<resources>
<resource>
<targetPath>/</targetPath>
Expand Down
28 changes: 20 additions & 8 deletions apollo-portal/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,36 @@
# 3. Run with: docker run -p 8070:8070 -e SPRING_DATASOURCE_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloPortalDB?characterEncoding=utf8" -e SPRING_DATASOURCE_USERNAME=FillInCorrectUser -e SPRING_DATASOURCE_PASSWORD=FillInCorrectPassword -e APOLLO_PORTAL_ENVS=dev,pro -e DEV_META=http://fill-in-dev-meta-server:8080 -e PRO_META=http://fill-in-pro-meta-server:8080 -d -v /tmp/logs:/opt/logs --name apollo-portal apolloconfig/apollo-portal

FROM openjdk:8-jre-alpine
MAINTAINER ameizi <[email protected]>
LABEL maintainer="[email protected];ameizi<[email protected]>"

RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk update upgrade \
&& apk add --no-cache unzip

ARG VERSION
ENV VERSION $VERSION

COPY apollo-portal-${VERSION}-github.zip /apollo-portal/apollo-portal-${VERSION}-github.zip

RUN unzip /apollo-portal/apollo-portal-${VERSION}-github.zip -d /apollo-portal \
&& rm -rf /apollo-portal/apollo-portal-${VERSION}-github.zip \
&& chmod +x /apollo-portal/scripts/startup.sh

FROM openjdk:8-jre-alpine
LABEL maintainer="[email protected];ameizi<[email protected]>"

ENV APOLLO_RUN_MODE "Docker"
ENV VERSION 1.9.0-SNAPSHOT
ENV SERVER_PORT 8070

RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
&& echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
&& apk update upgrade \
&& apk add --no-cache procps unzip curl bash tzdata \
&& apk add --no-cache procps curl bash tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone

ADD apollo-portal-${VERSION}-github.zip /apollo-portal/apollo-portal-${VERSION}-github.zip

RUN unzip /apollo-portal/apollo-portal-${VERSION}-github.zip -d /apollo-portal \
&& rm -rf /apollo-portal/apollo-portal-${VERSION}-github.zip \
&& chmod +x /apollo-portal/scripts/startup.sh
COPY --from=0 /apollo-portal /apollo-portal

EXPOSE $SERVER_PORT

Expand Down

0 comments on commit aa4c3a9

Please sign in to comment.