mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-14 19:43:49 +00:00
Added scripts to pass version when building docker image
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
FROM node:12.14.1-alpine as node
|
FROM node:12.14.1-alpine as node
|
||||||
COPY . /shlink-web-client
|
COPY . /shlink-web-client
|
||||||
RUN cd /shlink-web-client && npm install && npm run build
|
ARG VERSION="latest"
|
||||||
|
ENV VERSION ${VERSION}
|
||||||
|
RUN cd /shlink-web-client && npm install && npm run build -- ${VERSION} --no-dist
|
||||||
|
|
||||||
FROM nginx:1.17.7-alpine
|
FROM nginx:1.17.7-alpine
|
||||||
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
|
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
|
||||||
|
|||||||
10
hooks/build
Executable file
10
hooks/build
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
if [[ ${SOURCE_BRANCH} == 'master' ]]; then
|
||||||
|
SHLINK_WEB_CLIENT_RELEASE='latest'
|
||||||
|
else
|
||||||
|
SHLINK_WEB_CLIENT_RELEASE=${SOURCE_BRANCH#?}
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build --build-arg VERSION=${SHLINK_WEB_CLIENT_RELEASE} -t ${IMAGE_NAME} .
|
||||||
@@ -44,6 +44,7 @@ if (!checkRequiredFiles([ paths.appHtml, paths.appIndexJs ])) {
|
|||||||
const argvSliceStart = 2;
|
const argvSliceStart = 2;
|
||||||
const argv = process.argv.slice(argvSliceStart);
|
const argv = process.argv.slice(argvSliceStart);
|
||||||
const writeStatsJson = argv.indexOf('--stats') !== -1;
|
const writeStatsJson = argv.indexOf('--stats') !== -1;
|
||||||
|
const withoutDist = argv.indexOf('--no-dist') !== -1;
|
||||||
const { version, hasVersion } = getVersionFromArgs(argv);
|
const { version, hasVersion } = getVersionFromArgs(argv);
|
||||||
|
|
||||||
// Generate configuration
|
// Generate configuration
|
||||||
@@ -102,7 +103,7 @@ checkBrowsers(paths.appPath, isInteractive)
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => hasVersion && zipDist(version))
|
.then(() => hasVersion && !withoutDist && zipDist(version))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err && err.message) {
|
if (err && err.message) {
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user