-
Notifications
You must be signed in to change notification settings - Fork 27
Fix docker setup #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix docker setup #233
Changes from all commits
343a7a3
159054f
0fcf885
1da0906
8a5b3a1
ada1f5b
3867418
7d4c13b
2433ff3
3543185
964f232
b5058ed
03a77bb
5570729
47c7e35
601a6f8
656a35e
e69f6a3
26346e5
b638dfa
703fcde
01054f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,6 @@ node_modules/ | |
| build/ | ||
| npm-debug.log | ||
| Dockerfile | ||
| .env | ||
| docker-compose*.yml | ||
| .env-secrets | ||
| .env | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # WEBAPP | ||
| WEBAPP_HOST = localhost | ||
| WEBAPP_PORT = 3000 | ||
| WEBAPP_BASE_URL = http://localhost:3000 | ||
|
|
||
| # API | ||
| API_HOST = localhost | ||
| API_PORT = 3030 | ||
|
|
||
| # METAAPI | ||
| EMBED_API_URL = http://localhost:3050 | ||
|
|
||
| # 3rd party integrations | ||
| SENTRY_DNS_PUBLIC = | ||
| MAPBOX_TOKEN = pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ | ||
|
|
||
| # MAINTENANCE | ||
| MAINTENANCE = |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,6 @@ npm-debug.log | |
| /nbproject/private/ | ||
| /nbproject/ | ||
|
|
||
| # .env and .env-secrets | ||
| .env | ||
| .env-secrets | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,26 @@ | ||
| FROM node:8.9-alpine | ||
| LABEL Description="This image is used to start the hc-frontend-nuxt" Vendor="Human-Connection gGmbH" Version="1.0" Maintainer="Human-Connection gGmbH (developer@human-connection.org)" | ||
|
|
||
| # update unix packages | ||
| RUN apk update && apk upgrade | ||
| RUN apk add git | ||
| RUN rm -rf /var/cache/apk/* | ||
|
|
||
| # install global dependencies | ||
| RUN yarn global add pm2 envsub | ||
| FROM node:10-alpine | ||
| LABEL Description="This image builds and runs the Human-Connection Frontend" Vendor="Human-Connection gGmbH" Version="1.0" Maintainer="Human-Connection gGmbH (developer@human-connection.org)" | ||
|
|
||
| # expose the app port | ||
| EXPOSE 3000 | ||
|
|
||
| # set environment variables | ||
| ENV HOST=0.0.0.0 | ||
| ENV WEBAPP_HOST=0.0.0.0 | ||
|
|
||
| ENTRYPOINT ["./entrypoint.sh"] | ||
|
|
||
| # create working directory | ||
| RUN mkdir -p /var/www/ | ||
| WORKDIR /var/www/ | ||
|
|
||
| # install app dependencies | ||
| COPY package.json /var/www/ | ||
| COPY yarn.lock /var/www/ | ||
| RUN yarn install --frozen-lockfile --non-interactive | ||
|
|
||
| # copy the code to the docker image | ||
| COPY . /var/www/ | ||
| # optional git commit hash | ||
| ARG BUILD_COMMIT | ||
| ENV BUILD_COMMIT=$BUILD_COMMIT | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing parts should always go lower to increase cache efficienty at build time. |
||
| ENV NODE_ENV=production | ||
|
|
||
| # set execution rights on scripts and run the build script | ||
| RUN chmod +x entrypoint.sh | ||
| RUN chmod +x scripts/on-build.sh | ||
| RUN chmod +x scripts/on-start.sh | ||
| RUN sh scripts/on-build.sh | ||
| RUN mkdir -p /WebApp/ | ||
| WORKDIR /WebApp/ | ||
| # --no-cache: download package index on-the-fly, no need to cleanup afterwards | ||
| # --virtual: bundle packages, remove whole bundle at once, when done | ||
| RUN apk --no-cache --virtual build-dependencies add git python make g++ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @roschaefer What about security updates? Dont we need them?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also why do you need phython, make and g++?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was having troubles to build other dependencies. Surprisingly. I haven't researched the issue but as far as I remember that was related to the newer node version of this docker container. 🤔
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with node:8-alpine it does work, with node:alpine not |
||
|
|
||
| # buld application | ||
| # ENV NODE_ENV=production #we seam to have issues with the production flag on install && build | ||
| RUN yarn build | ||
| RUN yarn global add pm2 | ||
|
|
||
| ENV NODE_ENV=production | ||
| COPY package.json /WebApp/ | ||
| COPY yarn.lock /WebApp/ | ||
| RUN yarn install --production=false --frozen-lockfile --non-interactive | ||
|
|
||
| # only keep production dependencies | ||
| # RUN yarn install --frozen-lockfile --non-interactive | ||
| COPY . /WebApp/ | ||
| RUN ["yarn", "run", "build"] | ||
| CMD ["pm2", "start", "node", "build/main.js", "-n", "frontend", "-i", "2", "--attach"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe use |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| version: '3.5' | ||
|
|
||
| services: | ||
| webapp: | ||
| environment: | ||
| - NODE_ENV=development | ||
| volumes: | ||
| - .:/WebApp/ | ||
| - /WebApp/node_modules | ||
| command: yarn run dev | ||
| tty: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| version: '3.5' | ||
|
|
||
| services: | ||
| webapp: | ||
| environment: | ||
| - NODE_ENV=development # this is just `development` so https will not be enforced | ||
| - MAINTENANCE=${MAINTENANCE} | ||
| - SENTRY_DNS_PUBLIC=${SENTRY_DNS_PUBLIC} | ||
| - EMBED_API_URL=${EMBED_API_URL} | ||
| # these secrets should only be accessible on the server: | ||
| - SENTRY_DNS_PRIVATE=${SENTRY_DNS_PRIVATE} | ||
| - EMBED_API_TOKEN=${EMBED_API_TOKEN} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,24 @@ | ||
| version: '2' | ||
| version: '3.5' | ||
|
|
||
| services: | ||
| frontend: | ||
| build: . | ||
| environment: | ||
| WEBAPP_HOST: localhost | ||
| WEBAPP_PORT: 3000 | ||
| WEBAPP_BASE_URL: http://localhost:3000 | ||
| API_HOST: http://localhost | ||
| API_PORT: 3030 | ||
| MAPBOX_TOKEN: | ||
| stdin_open: true | ||
| tty: true | ||
| webapp: | ||
| image: humanconnection/frontend-nuxt:edge | ||
| ports: | ||
| - 3000:3000/tcp | ||
| - "3000:3000" | ||
| build: | ||
| context: . | ||
| args: | ||
| BUILD_COMMIT: ${BUILD_COMMIT} | ||
| networks: | ||
| - hc-network | ||
| environment: | ||
| - WEBAPP_HOST=webapp | ||
| - WEBAPP_BASE_URL=http://localhost:3000 | ||
| - API_HOST=api.127.0.0.1.xip.io | ||
| - WEBAPP_PORT=3000 | ||
| - API_PORT=3030 | ||
| - MAPBOX_TOKEN=pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ | ||
|
|
||
| networks: | ||
| hc-network: | ||
| name: hc-network |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@appinteractive is this redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it can be removed. Was caused by the unversionated bode image before.