mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-12 18:43:50 +00:00
Merge pull request #232 from acelaya-forks/feature/improve-docker-build
Feature/improve docker build
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
./.github
|
./.github
|
||||||
./build
|
./build
|
||||||
./coverage
|
./coverage
|
||||||
./dist
|
|
||||||
./node_modules
|
./node_modules
|
||||||
./test
|
./test
|
||||||
./shlink-web-client.gif
|
./shlink-web-client.gif
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ after_success:
|
|||||||
|
|
||||||
# Before deploying, build dist file for current travis tag
|
# Before deploying, build dist file for current travis tag
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- npm run build ${TRAVIS_TAG#?}
|
- if [[ ! -z $TRAVIS_TAG ]]; then npm run build ${TRAVIS_TAG#?} ; fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
- provider: script
|
- provider: script
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ FROM node:12.14.1-alpine as node
|
|||||||
COPY . /shlink-web-client
|
COPY . /shlink-web-client
|
||||||
ARG VERSION="latest"
|
ARG VERSION="latest"
|
||||||
ENV VERSION ${VERSION}
|
ENV VERSION ${VERSION}
|
||||||
RUN cd /shlink-web-client && npm install && npm run build -- ${VERSION} --no-dist
|
RUN cd /shlink-web-client && \
|
||||||
|
UNCOMPRESSED="shlink-web-client_${VERSION}_dist" && \
|
||||||
|
DIST_FILE="./dist/${UNCOMPRESSED}.zip" && \
|
||||||
|
# If a dist file already exists, just unzip it
|
||||||
|
if [[ -f ${DIST_FILE} ]]; then unzip ${DIST_FILE} && mv ./${UNCOMPRESSED} ./build ; fi && \
|
||||||
|
# If no dist file exsts, build from scratch
|
||||||
|
if [[ ! -f ${DIST_FILE} ]]; then npm install && npm run build -- ${VERSION} --no-dist ; fi
|
||||||
|
|
||||||
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>"
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ set -e
|
|||||||
|
|
||||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|
||||||
# If a tag exists, build both that tag and stable
|
if [[ -z $TRAVIS_TAG ]]; then
|
||||||
if [[ ! -z $TRAVIS_TAG ]]; then
|
docker build -t shlinkio/shlink-web-client:latest .
|
||||||
docker build --build-arg VERSION=${TRAVIS_TAG#?} -t shlinkio/shlink-web-client:${TRAVIS_TAG#?} -t shlinkio/shlink-web-client:stable .
|
else
|
||||||
|
docker build --build-arg VERSION=${TRAVIS_TAG#?} -t shlinkio/shlink-web-client:${TRAVIS_TAG#?} -t shlinkio/shlink-web-client:stable -t shlinkio/shlink-web-client:latest .
|
||||||
docker push shlinkio/shlink-web-client:${TRAVIS_TAG#?}
|
docker push shlinkio/shlink-web-client:${TRAVIS_TAG#?}
|
||||||
docker push shlinkio/shlink-web-client:stable
|
docker push shlinkio/shlink-web-client:stable
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build -t shlinkio/shlink-web-client:latest .
|
|
||||||
docker push shlinkio/shlink-web-client:latest
|
docker push shlinkio/shlink-web-client:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user