diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..96f81bc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +.git diff --git a/.drone.yml b/.drone.yml index b45c78b..2edfc84 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4f62cf3 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..41c8f44 --- /dev/null +++ b/compose.yml @@ -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 diff --git a/package.json b/package.json index d73a2d9..dede102 100644 --- a/package.json +++ b/package.json @@ -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": [],