Dockerfile forwards version parameter

This commit is contained in:
Robert Bendun 2023-01-15 01:11:10 +01:00
parent 9f57bbaecd
commit a2149aa4ce
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,6 @@
FROM ubuntu:20.04 AS linux FROM ubuntu:20.04 AS linux
ARG TZ=Europe/Warsaw ARG TZ=Europe/Warsaw
ARG VERSION
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y make software-properties-common zip unzip git RUN apt update && apt install -y make software-properties-common zip unzip git
RUN add-apt-repository ppa:ubuntu-toolchain-r/test RUN add-apt-repository ppa:ubuntu-toolchain-r/test
@ -11,10 +12,11 @@ COPY .git /src/.git/
COPY musique /src/musique/ COPY musique /src/musique/
COPY lib /src/lib/ COPY lib /src/lib/
COPY scripts /src/scripts/ COPY scripts /src/scripts/
RUN make clean && make CC=gcc-11 CXX=g++-11 RUN make clean && make CC=gcc-11 CXX=g++-11 VERSION="$VERSION"
FROM ubuntu:22.04 AS windows FROM ubuntu:22.04 AS windows
ARG VERSION
RUN apt update && apt install -y git make gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 RUN apt update && apt install -y git make gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
RUN mkdir -p /src/ RUN mkdir -p /src/
WORKDIR /src/ WORKDIR /src/
@ -23,7 +25,7 @@ COPY .git /src/.git/
COPY musique /src/musique/ COPY musique /src/musique/
COPY lib /src/lib/ COPY lib /src/lib/
COPY scripts /src/scripts/ COPY scripts /src/scripts/
RUN make clean && make os=windows CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix RUN make clean && make os=windows CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix VERSION="$VERSION"
FROM ubuntu:22.04 AS release FROM ubuntu:22.04 AS release

View File

@ -47,13 +47,13 @@ doc/wprowadzenie.html: doc/wprowadzenie.md
doc/functions.html: musique/interpreter/builtin_functions.cc scripts/document-builtin.py doc/functions.html: musique/interpreter/builtin_functions.cc scripts/document-builtin.py
scripts/document-builtin.py -o $@ $< scripts/document-builtin.py -o $@ $<
musique.zip: doc/* $(Sources) scripts/* musique.zip:
docker build -t musique-builder . docker build -t musique-builder --build-arg "VERSION=$(VERSION)" .
docker create --name musique musique-builder docker create --name musique musique-builder
docker cp musique:/musique.zip musique.zip docker cp musique:/musique.zip musique.zip
docker rm -f musique docker rm -f musique
.PHONY: clean doc doc-open all test unit-tests release install .PHONY: clean doc doc-open all test unit-tests release install musique.zip
$(shell mkdir -p $(subst musique/,bin/$(os)/,$(shell find musique/* -type d))) $(shell mkdir -p $(subst musique/,bin/$(os)/,$(shell find musique/* -type d)))
$(shell mkdir -p $(subst musique/,bin/$(os)/debug/,$(shell find musique/* -type d))) $(shell mkdir -p $(subst musique/,bin/$(os)/debug/,$(shell find musique/* -type d)))