1
Fork 0

Add docker support

This commit is contained in:
viktorstrate 2019-07-29 23:39:38 +02:00
parent 5e41e4d34d
commit c70cc402b0
17 changed files with 15398 additions and 6719 deletions

2
api/.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules/
build/

View File

@ -3,10 +3,10 @@ FROM node:10
RUN mkdir -p /app RUN mkdir -p /app
WORKDIR /app WORKDIR /app
COPY package.json . COPY package*.json ./
RUN npm install RUN npm install
COPY . . COPY . .
EXPOSE 4000 EXPOSE 4001
CMD ["npm", "start"] CMD ["npm", "start"]

7069
api/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
version: '3' version: '3'
services: services:
neo4j: neo4j:
build: ./neo4j build: ./docker/neo4j
ports: expose:
- 7474:7474 - 7474
- 7687:7687 - 7687
environment: environment:
- NEO4J_dbms_security_procedures_unrestricted=apoc.* - NEO4J_dbms_security_procedures_unrestricted=apoc.*
- NEO4J_apoc_import_file_enabled=true - NEO4J_apoc_import_file_enabled=true
@ -16,17 +15,19 @@ services:
api: api:
build: ./api build: ./api
ports: ports:
- 4000:4000 - 4001:4001
links:
- neo4j
depends_on: depends_on:
- neo4j - neo4j
environment:
- NEO4J_URI=bolt://neo4j:7687
ui: ui:
build: ./ui build:
context: ./ui
args:
# Change This: The publicly exposed url for the api
endpoint: http://localhost:4001/graphql
ports: ports:
- 3000:3000 - 3000:80
links:
- api
depends_on: depends_on:
- api - api

3
ui/.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules/
dist/
.cache/

View File

@ -1,12 +1,21 @@
# Build the app
FROM node:10 FROM node:10
ARG endpoint
ENV REACT_APP_GRAPHQL_URI=${endpoint}
RUN mkdir -p /app RUN mkdir -p /app
WORKDIR /app WORKDIR /app
COPY package.json . COPY package*.json ./
RUN npm install RUN npm install
COPY . . COPY . .
EXPOSE 3000 RUN npm run build
CMD ["npm", "start"] # Copy built app to nginx environment
FROM nginx:stable
COPY --from=0 /app/dist /usr/share/nginx/html
EXPOSE 80

8285
ui/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
}, },
"scripts": { "scripts": {
"start": "parcel start src/index.html", "start": "parcel start src/index.html",
"build": "react-scripts build", "build": "parcel build src/index.html",
"test": "react-scripts test --env=jsdom", "test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"now-build": "react-scripts build" "now-build": "react-scripts build"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,49 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View File

@ -1,15 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -1,5 +1,7 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { createGlobalStyle } from 'styled-components' import { createGlobalStyle } from 'styled-components'
import Routes from './Routes'
import Messages from './Messages'
const GlobalStyle = createGlobalStyle` const GlobalStyle = createGlobalStyle`
#root, body { #root, body {
@ -8,9 +10,6 @@ const GlobalStyle = createGlobalStyle`
} }
` `
import Routes from './Routes'
import Messages from './Messages'
class App extends Component { class App extends Component {
render() { render() {
return ( return (

View File

@ -1,4 +1,4 @@
import React, { Component, useState } from 'react' import React, { Component } from 'react'
import styled from 'styled-components' import styled from 'styled-components'
import { Message, Progress } from 'semantic-ui-react' import { Message, Progress } from 'semantic-ui-react'
import gql from 'graphql-tag' import gql from 'graphql-tag'

View File

@ -42,7 +42,7 @@ class AlbumPage extends Component {
presenting: false, presenting: false,
} }
const presentIndex = presentIndexFromHash(location.hash) const presentIndex = presentIndexFromHash(document.location.hash)
if (presentIndex) { if (presentIndex) {
this.state.activeImage = presentIndex this.state.activeImage = presentIndex
this.state.presenting = true this.state.presenting = true
@ -82,13 +82,17 @@ class AlbumPage extends Component {
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (this.state.presenting) { if (this.state.presenting) {
history.replaceState( document.history.replaceState(
null, null,
null, null,
document.location.pathname + '#' + `present=${this.state.activeImage}` document.location.pathname + '#' + `present=${this.state.activeImage}`
) )
} else if (presentIndexFromHash(location.hash)) { } else if (presentIndexFromHash(document.location.hash)) {
history.replaceState(null, null, document.location.pathname.split('#')[0]) document.history.replaceState(
null,
null,
document.location.pathname.split('#')[0]
)
} }
} }

File diff suppressed because it is too large Load Diff