Dockerfile improvements
This commit is contained in:
parent
80cc5e937e
commit
570c6d03b3
3 changed files with 26 additions and 1 deletions
|
|
@ -14,7 +14,16 @@ build:
|
|||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- docker build -f k8s/Dockerfile -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -t $CI_REGISTRY_IMAGE:latest .
|
||||
# Pull latest image for layer caching (ignore failures if not exists)
|
||||
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
||||
# Build with cache-from for faster builds and inline cache for future builds
|
||||
- docker build
|
||||
--cache-from $CI_REGISTRY_IMAGE:latest
|
||||
--build-arg BUILDKIT_INLINE_CACHE=1
|
||||
-f k8s/Dockerfile
|
||||
-t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
-t $CI_REGISTRY_IMAGE:latest
|
||||
.
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker push $CI_REGISTRY_IMAGE:latest
|
||||
rules:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
|
||||
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
|
||||
# instead of Alpine to avoid DNS resolution issues in production.
|
||||
#
|
||||
|
|
@ -22,6 +24,7 @@ FROM ${BUILDER_IMAGE} AS builder
|
|||
|
||||
# install build dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends build-essential git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -71,6 +74,7 @@ RUN mix release
|
|||
FROM ${RUNNER_IMAGE} AS final
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 locales ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -98,4 +102,8 @@ USER nobody
|
|||
# above and adding an entrypoint. See https://github.com/krallin/tini for details
|
||||
# ENTRYPOINT ["/tini", "--"]
|
||||
|
||||
# Health check for container orchestration
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
|
||||
CMD ["/app/bin/towerops", "rpc", "1 + 1"]
|
||||
|
||||
CMD ["/app/bin/server"]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# syntax=docker/dockerfile:1.4
|
||||
|
||||
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
|
||||
# instead of Alpine to avoid DNS resolution issues in production.
|
||||
#
|
||||
|
|
@ -22,6 +24,7 @@ FROM ${BUILDER_IMAGE} AS builder
|
|||
|
||||
# install build dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends build-essential git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -71,6 +74,7 @@ RUN mix release
|
|||
FROM ${RUNNER_IMAGE} AS final
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 locales ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -98,4 +102,8 @@ USER nobody
|
|||
# above and adding an entrypoint. See https://github.com/krallin/tini for details
|
||||
# ENTRYPOINT ["/tini", "--"]
|
||||
|
||||
# Health check for container orchestration
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
|
||||
CMD ["/app/bin/towerops", "rpc", "1 + 1"]
|
||||
|
||||
CMD ["/app/bin/server"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue