Mayank
4 years ago
2 changed files with 93 additions and 0 deletions
@ -0,0 +1,62 @@ |
|||
name: Automatically Build image on tag |
|||
env: |
|||
DOCKER_CLI_EXPERIMENTAL: enabled |
|||
TAG_FMT: '^refs/tags/(((.?[0-9]+){3,4}))$' |
|||
|
|||
on: |
|||
push: |
|||
tags: [ '*' ] |
|||
|
|||
jobs: |
|||
build: |
|||
runs-on: ubuntu-18.04 |
|||
name: Build / Push Umbrel Dashboard on version tag |
|||
steps: |
|||
- name: Setup Environment |
|||
run: | |
|||
if ! echo "$GITHUB_REF" | grep -qE "$TAG_FMT"; then |
|||
echo "ERR: TAG must be in format: vX.Y.Z or X.Y.Z or vW.X.Y.Z or W.X.Y.Z" |
|||
exit 1 |
|||
fi |
|||
VERSION="$(echo "$GITHUB_REF" | sed -E "s|$TAG_FMT|\2|")" |
|||
|
|||
TAG="$(echo "$GITHUB_REF" | sed -E "s|$TAG_FMT|\1|")" |
|||
echo ::set-env name=TAG::"$TAG" |
|||
|
|||
- name: Show set environment variables |
|||
run: | |
|||
printf " TAG: %s\n" "$TAG" |
|||
- name: Login to Docker for building |
|||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin |
|||
- name: Checkout project |
|||
uses: actions/checkout@v2 |
|||
- name: Setup Docker buildx Action |
|||
uses: crazy-max/ghaction-docker-buildx@v1 |
|||
id: buildx |
|||
with: |
|||
buildx-version: latest |
|||
qemu-version: latest |
|||
- name: Available platforms |
|||
run: echo ${{ steps.buildx.outputs.platforms }} |
|||
- name: Run Docker build X (against tag) |
|||
run: | |
|||
docker buildx build \ |
|||
--platform linux/amd64,linux/386,linux/arm/v7,linux/arm64 \ |
|||
-t getumbrel/manager:$TAG \ |
|||
--output "type=registry" \ |
|||
. |
|||
- name: Run Docker build X (against latest) |
|||
run: | |
|||
docker buildx build \ |
|||
--platform linux/amd64,linux/386,linux/arm/v7,linux/arm64 \ |
|||
-t getumbrel/manager:latest \ |
|||
--output "type=registry" \ |
|||
. |
|||
- name: Run Docker buildx (against stage) |
|||
run: | |
|||
docker buildx build \ |
|||
--platform linux/amd64 \ |
|||
-f ./Dockerfile.stage \ |
|||
-t getumbrel/manager:stage \ |
|||
--output "type=registry" \ |
|||
. |
@ -0,0 +1,31 @@ |
|||
FROM node:12.16.3-alpine |
|||
|
|||
# install simple http server for serving static content |
|||
RUN yarn global add http-server |
|||
|
|||
# make the 'app' folder the current working directory |
|||
WORKDIR /app |
|||
|
|||
# copy 'package.json' |
|||
COPY package.json ./ |
|||
|
|||
# copy 'yarn.lock' |
|||
COPY yarn.lock ./ |
|||
|
|||
# install dependencies |
|||
RUN yarn |
|||
|
|||
# copy project files and folders to the current working directory (i.e. 'app' folder) |
|||
COPY . . |
|||
|
|||
# Set staging env variable if building for testnet.getumbrel.com |
|||
ENV STAGING_DEPLOYMENT=true |
|||
|
|||
# build app for production |
|||
RUN yarn build |
|||
|
|||
# copy index.html to 404.html as http-server serves 404.html on all non "/" routes |
|||
RUN cp ./dist/index.html ./dist/404.html |
|||
|
|||
EXPOSE 3004 |
|||
CMD [ "http-server", "-p 3004", "dist" ] |
Loading…
Reference in new issue