From a2f174f687c53ec7965d457a6c9afc2ec6431d05 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 6 Aug 2018 19:41:57 +0200 Subject: [PATCH 1/4] Updated docker-compose files so that they just use an image and don't need the Dockerfile --- docker-compose.override.yml.dist | 10 +++++----- docker-compose.yml | 19 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/docker-compose.override.yml.dist b/docker-compose.override.yml.dist index f9ad2f8f..ede39ef0 100644 --- a/docker-compose.override.yml.dist +++ b/docker-compose.override.yml.dist @@ -1,8 +1,8 @@ version: '3' services: - shlink_web_client_node: - user: 1000:1000 - volumes: - - /etc/passwd:/etc/passwd:ro - - /etc/group:/etc/group:ro + shlink_web_client_node: + user: 1000:1000 + volumes: + - /etc/passwd:/etc/passwd:ro + - /etc/group:/etc/group:ro diff --git a/docker-compose.yml b/docker-compose.yml index 5ecdd13d..c3cca438 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,12 @@ version: '3' services: - shlink_web_client_node: - container_name: shlink_web_client_node - build: - context: . - dockerfile: ./Dockerfile - volumes: - - ./:/home/shlink/www - ports: - - "3000:3000" - - "56745:56745" + shlink_web_client_node: + container_name: shlink_web_client_node + image: node:10.4.1-alpine + command: /bin/sh -c "cd /home/shlink/www && yarn install && yarn start" + volumes: + - ./:/home/shlink/www + ports: + - "3000:3000" + - "56745:56745" From a5fb505affeb9dc820a0b0d6f25b158aa70667db Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 6 Aug 2018 20:16:07 +0200 Subject: [PATCH 2/4] Updated dockerfile to be used to build a distributable docker image --- .dockerignore | 4 ++++ Dockerfile | 25 ++++++++++++++++++------- README.md | 22 +++++++++++++++++++++- 3 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..74976a73 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +./build +./dist +./node_modules +./test diff --git a/Dockerfile b/Dockerfile index 6ff46d10..a844af6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,23 @@ -FROM node:10.4.1-alpine +FROM nginx:1.15.2-alpine MAINTAINER Alejandro Celaya -# Install yarn -RUN apk add --no-cache --virtual yarn +# Install node and yarn +RUN apk add --no-cache --virtual nodejs && apk add --no-cache --virtual yarn -# Make home dir writable by anyone -RUN chmod 777 /home +ADD . ./shlink-web-client -CMD cd /home/shlink/www && \ +# Install dependencies and build project +RUN cd ./shlink-web-client && \ yarn install && \ - yarn start + yarn build && \ + + # Move build contents to document root + cd .. && \ + rm -r /usr/share/nginx/html/* && \ + mv ./shlink-web-client/build/* /usr/share/nginx/html && \ + rm -r ./shlink-web-client && \ + + # Delete and uninstall build tools + yarn cache clean && apk del yarn && apk del nodejs + +WORKDIR /usr/share/nginx/html diff --git a/README.md b/README.md index a23d1eea..50ec89ef 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,24 @@ [![Build Status](https://travis-ci.org/shlinkio/shlink-web-client.svg?branch=master)](https://travis-ci.org/shlinkio/shlink-web-client) -A React-based client application for [Shlink](https://shlink.io) +A ReactJS-based progressive web application for [Shlink](https://shlink.io). + +## Installation + +There are three ways in which you can use this application. + +* The easiest way to use shlink-web-client is by just going to https://app.shlink.io. + + The application runs 100% in the browser, so you can use that instance and access any shlink instance from it. + +* Self hosting the application yourself. + + Get the [latest release](https://github.com/shlinkio/shlink-web-client/releases/latest) and download the distributable zip file attached to it (`shlink-web-client_X.X.X_dist.zip`). + + The package contains static files only, so just put it in a folder and serve it with the web server of your choice (just take into account that all the files are served using absolute paths, so you have to serve it from the root of your domain, not from a subpath). + +* Use the official [docker image](https://hub.docker.com/r/shlinkio/shlink-web-client/) + + If you want to deploy shlink-web-client in a container-based cluster (docker swarm, kubernetes, etc), just pick the image and do it. + + It's a lightweight [nginx:alpine image](https://hub.docker.com/r/library/nginx/) serving the assets on port 80. From 33bec0f05df88b7cf6e5caad58c8189f283d5801 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 6 Aug 2018 20:19:20 +0200 Subject: [PATCH 3/4] Created changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..49db70ab --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# CHANGELOG + +## 0.1.1 - 2018-08-06 + +#### Added + +* [#15](https://github.com/shlinkio/shlink-web-client/issues/15) Added a `Dockerfile` that can be used to generate a distributable docker image + +#### Changed + +* *Nothing* + +#### Deprecated + +* *Nothing* + +#### Removed + +* *Nothing* + +#### Fixed + +* *Nothing* From f3a3854c1f6d76529ac2338efcda0f4100d506ea Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 6 Aug 2018 20:32:14 +0200 Subject: [PATCH 4/4] Removed workdir from Dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a844af6e..fd87d803 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,5 +19,3 @@ RUN cd ./shlink-web-client && \ # Delete and uninstall build tools yarn cache clean && apk del yarn && apk del nodejs - -WORKDIR /usr/share/nginx/html