diff --git a/.dockerignore b/.dockerignore index 5171c54..be540e1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ node_modules -npm-debug.log \ No newline at end of file +npm-debug.log +test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index bdfaca7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM alpine:latest - -RUN mkdir -p /usr/src/ -#Install Software -RUN apk add --update nodejs npm git - -RUN cd /usr/src && git clone https://github.com/orangecoding/fredy.git - -RUN ln -s /usr/src/fredy/conf/ /conf - -RUN cd /usr/src/fredy/ && npm install - -WORKDIR /usr/src/fredy - -EXPOSE 9998 - -VOLUME [ "/conf", "/db" ] -# --no-daemon is required for keeping Container alive -CMD node index.js --no-daemon \ No newline at end of file diff --git a/README.md b/README.md index d17ee59..9507669 100755 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Example: `docker build -t fredy/fredy /path/to/your/Dockerfile` Put your config.json to `/path/to/your/conf/` -Example: `docker create --name fredy -v /path/to/your/conf/:/conf -p 9988:9988 fredy/fredy` +Example: `docker create --name fredy -v /path/to/your/conf/:/conf -p 9998:9998 fredy/fredy` ## Logs diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..1360988 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,31 @@ +FROM alpine:latest AS build +# use given repository, default below: +ARG repo=https://github.com/orangecoding/fredy.git + +RUN mkdir -p /usr/src/ +#Install Software +RUN apk add --update nodejs npm git + +# Output used repository +RUN echo "Cloning from $repo" + +RUN cd /usr/src && git clone $repo + +RUN ln -s /usr/src/fredy/conf/ /conf + +# create db folder +RUN mkdir /usr/src/fredy/db/ + +RUN ln -s /usr/src/fredy/db/ /db + +RUN cd /usr/src/fredy/ && npm install + +WORKDIR /usr/src/fredy + +RUN npm run prod + +EXPOSE 9998 + +VOLUME [ "/conf", "/db" ] +# --no-daemon is required for keeping Container alive +CMD node index.js --no-daemon diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a399949 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.3' +services: + fredy: + container_name: fredy + # build from empty build folder to reduce size of image + build: + context: ./build + dockerfile: Dockerfile + args: + repo: https://github.com/anbucher/fredy.git + image: fredy/fredy + # map existing config and database + volumes: + - ./conf:/conf + - ./db:/db + ports: + - 9998:9998 \ No newline at end of file diff --git a/lib/notification/adapter/mailJet.md b/lib/notification/adapter/mailJet.md index 9ab8019..812db27 100644 --- a/lib/notification/adapter/mailJet.md +++ b/lib/notification/adapter/mailJet.md @@ -1,6 +1,6 @@ ### MailJet Adapter - -To use [MailJet](https://mailjet.com), you need to create an account. You'll need to decided from which email address you want Fredy to send from. - + +To use [MailJet](https://mailjet.com), you need to create an account. You'll need to decided from which email address you want Fredy to send from. + E.g. if you use yourGmailAccount@gmail.com, you have to add this to MailJet and verify it as well. The given public/private api keys are needed in order to use MailJet with Fredy. Fredy will use the same template, it is using for SendGrid. diff --git a/lib/notification/adapter/sendGrid.md b/lib/notification/adapter/sendGrid.md index 6e4d508..7d81af4 100644 --- a/lib/notification/adapter/sendGrid.md +++ b/lib/notification/adapter/sendGrid.md @@ -1,8 +1,8 @@ ### SendGrid Adapter - + SendGrid is a free email service (free as in "you cannot send more than 100(Sendgrid) and 200(Mailjet) emails a day"), which is more than enough for Fredy. - -To use [SendGrid](https://sendgrid.com/), you need to create an account. You'll need to decided from which email address you want Fredy to send from. E.g. if you use yourGmailAccount@gmail.com, you have to add this to sendgrid and verify it as well. + +To use [SendGrid](https://sendgrid.com/), you need to create an account. You'll need to decided from which email address you want Fredy to send from. E.g. if you use yourGmailAccount@gmail.com, you have to add this to sendgrid and verify it as well. Lastly you have to create an api-key and feed it into Fredy's config, as well as creating a new dynamic template. For this new template, I recommend copying and pasting the code from the one I have provided under `/lib/notification/emailTemplate/template.hbs`.