From 7d67d47a277aac42befdda7c52aacfdcf9eff9c3 Mon Sep 17 00:00:00 2001 From: ShiKhu Date: Thu, 5 Aug 2021 19:53:55 +0800 Subject: [PATCH] fix(backend): dockerfile names --- backend/Dockerfile | 30 +++++++-------------- backend/{Dockerfile-1 => Dockerfile.bundle} | 30 ++++++++++++++------- 2 files changed, 30 insertions(+), 30 deletions(-) rename backend/{Dockerfile-1 => Dockerfile.bundle} (60%) diff --git a/backend/Dockerfile b/backend/Dockerfile index 3105742cf..fe6e757e4 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -13,16 +13,15 @@ FROM prepare AS build COPY pkg pkg COPY services services -RUN for name in alerts assets db ender http integrations sink storage;do CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o bin/$name -tags musl openreplay/backend/services/$name; done - +ARG SERVICE_NAME +RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o service -tags musl openreplay/backend/services/$SERVICE_NAME FROM alpine -#FROM pygmy/alpine-tini:latest RUN apk add --no-cache ca-certificates ENV TZ=UTC \ FS_ULIMIT=1000 \ - FS_DIR=/filestorage \ + FS_DIR=/mnt/efs \ MAXMINDDB_FILE=/root/geoip.mmdb \ UAPARSER_FILE=/root/regexes.yaml \ HTTP_PORT=80 \ @@ -43,23 +42,14 @@ ENV TZ=UTC \ AWS_REGION_ASSETS=eu-central-1 \ CACHE_ASSETS=false \ ASSETS_SIZE_LIMIT=6291456 \ - FS_CLEAN_HRS=12 + FS_CLEAN_HRS=0 -RUN mkdir $FS_DIR -#VOLUME [ $FS_DIR ] # Uncomment in case of using Bind mount. - -RUN wget https://raw.githubusercontent.com/ua-parser/uap-core/master/regexes.yaml -O "$UAPARSER_FILE" &&\ - wget https://static.openreplay.com/geoip/GeoLite2-Country.mmdb -O "$MAXMINDDB_FILE" +ARG SERVICE_NAME +RUN if [ "$SERVICE_NAME" = "http" ]; then \ + wget https://raw.githubusercontent.com/ua-parser/uap-core/master/regexes.yaml -O "$UAPARSER_FILE" &&\ + wget https://static.openreplay.com/geoip/GeoLite2-Country.mmdb -O "$MAXMINDDB_FILE"; fi -WORKDIR /work - -COPY --from=build /root/bin ./bin -COPY entrypoint.sh . - -#### -RUN apk add --no-cache tini -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["./entrypoint.sh"] - +COPY --from=build /root/service /root/service +ENTRYPOINT /root/service diff --git a/backend/Dockerfile-1 b/backend/Dockerfile.bundle similarity index 60% rename from backend/Dockerfile-1 rename to backend/Dockerfile.bundle index fe6e757e4..3105742cf 100644 --- a/backend/Dockerfile-1 +++ b/backend/Dockerfile.bundle @@ -13,15 +13,16 @@ FROM prepare AS build COPY pkg pkg COPY services services -ARG SERVICE_NAME -RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o service -tags musl openreplay/backend/services/$SERVICE_NAME +RUN for name in alerts assets db ender http integrations sink storage;do CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o bin/$name -tags musl openreplay/backend/services/$name; done + FROM alpine +#FROM pygmy/alpine-tini:latest RUN apk add --no-cache ca-certificates ENV TZ=UTC \ FS_ULIMIT=1000 \ - FS_DIR=/mnt/efs \ + FS_DIR=/filestorage \ MAXMINDDB_FILE=/root/geoip.mmdb \ UAPARSER_FILE=/root/regexes.yaml \ HTTP_PORT=80 \ @@ -42,14 +43,23 @@ ENV TZ=UTC \ AWS_REGION_ASSETS=eu-central-1 \ CACHE_ASSETS=false \ ASSETS_SIZE_LIMIT=6291456 \ - FS_CLEAN_HRS=0 + FS_CLEAN_HRS=12 -ARG SERVICE_NAME -RUN if [ "$SERVICE_NAME" = "http" ]; then \ - wget https://raw.githubusercontent.com/ua-parser/uap-core/master/regexes.yaml -O "$UAPARSER_FILE" &&\ - wget https://static.openreplay.com/geoip/GeoLite2-Country.mmdb -O "$MAXMINDDB_FILE"; fi +RUN mkdir $FS_DIR +#VOLUME [ $FS_DIR ] # Uncomment in case of using Bind mount. + +RUN wget https://raw.githubusercontent.com/ua-parser/uap-core/master/regexes.yaml -O "$UAPARSER_FILE" &&\ + wget https://static.openreplay.com/geoip/GeoLite2-Country.mmdb -O "$MAXMINDDB_FILE" -COPY --from=build /root/service /root/service -ENTRYPOINT /root/service +WORKDIR /work + +COPY --from=build /root/bin ./bin +COPY entrypoint.sh . + +#### +RUN apk add --no-cache tini +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["./entrypoint.sh"] +