Skip to content

Commit

Permalink
Add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
MaKleSoft committed May 28, 2019
1 parent 96613af commit 07a7f5f
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 409 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
@@ -0,0 +1,11 @@
node_modules
packages/*/node_modules
packages/*/docs
packages/core/lib
packages/*/dist
packages/*/build
packages/app/test/dist
Dockerfile
.dockerignore
.git
.gitignore
20 changes: 20 additions & 0 deletions Dockerfile
@@ -0,0 +1,20 @@
FROM node

ENV PL_SERVER_PORT=3000
ENV PL_CLIENT_PORT=8080
ENV PL_DB_PATH=/home/data
ENV PL_ATTACHMENTS_PATH=/home/attachments

EXPOSE 3000
EXPOSE 8080

VOLUME ["/data", "/docs"]

WORKDIR /home/padloc/

COPY . .

RUN npm ci --unsafe-perm
RUN npm run build

CMD ["npm", "start"]
19 changes: 19 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,19 @@
version: "3"
services:
padloc:
build: .
ports:
- 8080:8080
- 3000:3000
environment:
- PL_EMAIL_USER
- PL_EMAIL_SERVER
- PL_EMAIL_PORT
- PL_EMAIL_PASSWORD
- PL_EMAIL_FROM
- PL_REPORT_ERRORS
- PL_SERVER_URL=http://192.168.1.8:3000
- PL_CLIENT_URL=http://192.168.1.8:8081
volumes:
- ./data:/data
- ./docs:/docs
4 changes: 2 additions & 2 deletions packages/app/package.json
Expand Up @@ -25,8 +25,8 @@
},
"description": "Padloc UI",
"scripts": {
"build": "tsc && polymer build && sed -i.bak 's@clientUrl: \".*\"@clientUrl: \"'$PL_CLIENT_URL'\"@' build/pwa/env.js && sed -i.bak 's@serverUrl: \".*\"@serverUrl: \"'$PL_SERVER_URL'\"@' build/pwa/env.js && rm build/pwa/env.js.bak",
"start": "cd build/pwa && polymer serve -p $PL_CLIENT_PORT",
"build": "tsc && polymer build",
"start": "cd build/pwa && echo \"window.env = { serverUrl: '$PTC_SERVER_URL', clientUrl: '$PTC_CLIENT_URL'};\" > env.js && polymer serve -p $PL_CLIENT_PORT --hostname 0.0.0.0",
"dev": "tsc --watch | polymer serve"
}
}
2 changes: 1 addition & 1 deletion packages/app/src/init.ts
Expand Up @@ -7,7 +7,7 @@ import { AjaxSender } from "./ajax.js";
import { WebPlatform } from "./platform.js";
import { LocalStorage } from "./storage.js";

const sender = new AjaxSender(window.env.serverUrl);
const sender = new AjaxSender((window.env && window.env.serverUrl) || "http://localhost:3000");
export const app = (window.app = new App(new LocalStorage(), sender));
export const router = (window.router = new Router());

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/spec/spec.ts
@@ -1,9 +1,9 @@
import "chai";
import { Err } from "../error";

export type Spec = (test: (name: string, fn: () => Promise<void>) => void, assert: Chai.Assert) => void;
export type Spec = (test: (name: string, fn: () => Promise<void>) => void, assert: any) => void;

export async function assertResolve(assert: Chai.Assert, fn: () => Promise<any>, message?: string) {
export async function assertResolve(assert: any, fn: () => Promise<any>, message?: string) {
let err: Err | null = null;
try {
await fn();
Expand All @@ -14,7 +14,7 @@ export async function assertResolve(assert: Chai.Assert, fn: () => Promise<any>,
assert.isNull(err, message);
}

export async function assertReject(assert: Chai.Assert, fn: () => Promise<any>, code: string, message?: string) {
export async function assertReject(assert: any, fn: () => Promise<any>, code: string, message?: string) {
let err: Err | null = null;
try {
await fn();
Expand Down

0 comments on commit 07a7f5f

Please sign in to comment.