Skip to content

Commit

Permalink
Merge pull request #3431 from romcheg/docker_snapshot
Browse files Browse the repository at this point in the history
Implement snapshot builds for docker images
  • Loading branch information
romcheg committed Mar 8, 2019
2 parents 04edc45 + 21cd1ac commit 09b131a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Makefile
Expand Up @@ -45,6 +45,20 @@ build-docker-image:
-t $(DOCKER_REPO_NAME)/ralph-static-nginx:latest \
-t "$(DOCKER_REPO_NAME)/ralph-static-nginx:$(version)" .

build-snapshot-docker-image: version = $(shell ./get_version.sh show)
build-snapshot-docker-image: build-snapshot-package
docker build \
-f docker/Dockerfile-prod \
--build-arg RALPH_VERSION="$(version)" \
--build-arg SNAPSHOT="1" \
-t $(DOCKER_REPO_NAME)/ralph:latest \
-t "$(DOCKER_REPO_NAME)/ralph:$(version)" .
docker build \
-f docker/Dockerfile-static \
--build-arg RALPH_VERSION="$(version)" \
-t $(DOCKER_REPO_NAME)/ralph-static-nginx:latest \
-t "$(DOCKER_REPO_NAME)/ralph-static-nginx:$(version)" .


install-js:
npm install
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile-prod
Expand Up @@ -5,6 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive
# Ralph configuration and paths
ARG RALPH_LOCAL_DIR="/var/local/ralph"
ARG RALPH_VERSION=""
ARG SNAPSHOT="0"
ENV PATH=/opt/ralph/ralph-core/bin/:$PATH
ENV RALPH_CONF_DIR="/etc/ralph"
ENV RALPH_LOCAL_DIR="$RALPH_LOCAL_DIR"
Expand Down Expand Up @@ -33,6 +34,7 @@ COPY contrib/common/apt/ralph.list \
docker/provision/start-ralph.sh \
docker/provision/wait-for-it.sh \
docker/provision/install_ralph.sh \
build/*$RALPH_VERSION*.deb \
docker/provision/init-ralph.sh $RALPH_IMAGE_TMP_DIR/

RUN "$RALPH_IMAGE_TMP_DIR/install_ralph.sh"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-static
Expand Up @@ -7,5 +7,5 @@ LABEL authors="Allegro.pl Sp. z o.o. and Contributors opensource@allegro.pl"
LABEL description="Static files for Ralph DCIM served by Nginx HTTP server."
LABEL version="$RALPH_VERSION"

COPY --from=allegro/ralph /usr/share/ralph/static /opt/static
COPY --from=allegro/ralph:latest /usr/share/ralph/static /opt/static
COPY contrib/docker/ralph.conf.nginx /etc/nginx/conf.d/default.conf
5 changes: 4 additions & 1 deletion docker/provision/install_ralph.sh
Expand Up @@ -31,13 +31,16 @@ install_release() {


install_snapshot() {
echo "Snapshot builds are not implemented yet"
local deb_file=$(ls -t ${RALPH_IMAGE_TMP_DIR}/*${RALPH_VERSION}*.deb | head -1)
apt-get update
apt-get -y install "${deb_file}"
}


cleanup() {
rm -rf /var/lib/apt/lists/*
rm -f "${RALPH_IMAGE_TMP_DIR}/ralph.list"
rm -f "${RALPH_IMAGE_TMP_DIR}/*.deb"
rm -- "$0"
}

Expand Down

0 comments on commit 09b131a

Please sign in to comment.