First stab at `elm-live` / compose deployment
continuous-integration/drone/push Build is failing Details

This commit is contained in:
3wc 2021-04-24 19:01:18 +02:00
parent 80da2b2276
commit 839675d12e
5 changed files with 73 additions and 15 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
Dockerfile
.git

View File

@ -2,19 +2,21 @@
kind: pipeline
name: deploy to dev.apps.coopcloud.tech
steps:
- name: build
image: codesimple/elm:0.19
commands:
- elm make src/Main.elm --optimize --output=public/dist/elm.compiled.js
- name: docker cp deploy
image: 3wordchant/docker-cp-deploy:latest
- name: build image
image: plugins/docker
settings:
host: swarm.autonomic.zone
service: dev_apps_coopcloud_tech
chdir: public
source: .
dest: /usr/share/nginx/html
deploy_key:
username:
from_secret: docker_reg_username
password:
from_secret: docker_reg_passwd
repo: 3wordchant/abra-apps
tags: latest
- name: deployment
image: decentral1se/stack-ssh-deploy:latest
settings:
stack: dev_apps_coopcloud_tech
deploy_key:
from_secret: drone_ssh_swarm.autonomic.zone
trigger:
branch:

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM node:12-alpine
RUN mkdir /code
WORKDIR /code
RUN apk add curl gzip \
--virtual .build-dependencies
# Install and cache dependencies
RUN curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz && \
gunzip elm.gz && \
chmod +x elm && \
mv elm /usr/local/bin/
COPY package*.json /code/
# Install elm-analyse, elm linter, and elm test
RUN npm install
ENV PATH=$PATH:/code/node_modules/elm-linter/bin:/code/node_modules/elm-format/bin:/code/node_modules/elm-test/bin
# Add remainder of files
COPY . .
ENTRYPOINT ["/usr/local/bin/npm"]

28
compose.yml Normal file
View File

@ -0,0 +1,28 @@
---
version: "3.8"
services:
app:
image: "3wordchant/abra-apps:latest"
networks:
- proxy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000"]
interval: 10s
timeout: 10s
retries: 10
start_period: 15s
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.services.mkdocs.loadbalancer.server.port=8000"
- "traefik.http.routers.mkdocs.rule=Host(`dev.apps.coopcloud.tecg`)"
- "traefik.http.routers.mkdocs.entrypoints=web-secure"
- "traefik.http.routers.mkdocs.tls.certresolver=production"
networks:
proxy:
external: true

View File

@ -1,9 +1,10 @@
{
"name": "our-elm-spa-app",
"name": "abra-apps",
"version": "1.0.0",
"description": "A project created with elm-spa",
"description": "Co-op Cloud app catalogue",
"scripts": {
"start": "npm install && npm run build:dev && npm run dev",
"prod": "npm install && npm run build && npm run serve",
"test": "elm-test",
"test:watch": "elm-test --watch",
"build": "run-s build:elm-spa build:elm",
@ -12,7 +13,8 @@
"build:elm": "elm make src/Main.elm --optimize --output=public/dist/elm.compiled.js",
"build:dev:elm": "elm make src/Main.elm --debug --output=public/dist/elm.compiled.js || true",
"build:elm-spa": "elm-spa build .",
"dev:elm": "elm-live src/Main.elm -u -d public -- --debug --output=public/dist/elm.compiled.js",
"serve": "elm-live src/Main.elm -u -d public -h 0.0.0.0 -- --output=public/dist/elm.compiled.js",
"dev:elm": "elm-live src/Main.elm -u -d public -h 0.0.0.0 -- --debug --output=public/dist/elm.compiled.js",
"dev:elm-spa": "chokidar src/Pages -c \"elm-spa build .\""
},
"keywords": [],