Skip to content

Commit

Permalink
parametrized Dockerfile's base and provided a helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomaqa committed May 29, 2024
1 parent aeaef1c commit 917eac5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Eternal glory to him
# Eternal suffering for every mistake

FROM debian:latest
ARG TARGET=debian:latest

FROM $TARGET
USER root

RUN apt-get update -y
Expand All @@ -21,4 +23,4 @@ WORKDIR opensmt
RUN make
# RUN make install

ENTRYPOINT ["build/opensmt"]
# ENTRYPOINT ["build/opensmt"]
17 changes: 17 additions & 0 deletions docker/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

DIR=$(dirname "$0")

REPO=opensmt
TAG=latest
ARGS=()

[[ -n $1 ]] && {
TARGET=$1
REPO+=-${TARGET%:*}
tag=${TARGET#*:}
[[ -n $tag ]] && TAG=$tag
ARGS+=(--build-arg "TARGET=$TARGET")
}

exec docker build -t $REPO:$TAG "${ARGS[@]}" "$DIR"

0 comments on commit 917eac5

Please sign in to comment.