Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Dockerize all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Schuhmacher committed Apr 18, 2020
1 parent 6c93c18 commit 634d9da
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/back/node_modules
/front/node_modules
/front/dist
npm-debug.log
.git
.gitignore
.eslintignore
.eslintrc.*
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY ./front/package*.json ./front/
RUN cd front && npm install
COPY ./front ./front/
RUN cd front && npm run build
COPY ./back/package*.json ./back/
RUN cd back && npm install
COPY ./back ./back/
WORKDIR /app/back
EXPOSE 3000
CMD ["npm", "run", "start"]
5 changes: 3 additions & 2 deletions back/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ const app = express()
const config = require('config');

const port = 3000
const HOST = '0.0.0.0'
var bodyParser = require('body-parser')

app.use(bodyParser.json())
app.use(express.static('dist'))
app.use(express.static('../front/dist'))

const httpClient = axios.create({
method: 'post',
Expand Down Expand Up @@ -54,4 +55,4 @@ app.get('/api/baseurl', (req, res) =>

app.get('/', (req, res) => res.send('Hello'))

app.listen(port)
app.listen(port, HOST)

0 comments on commit 634d9da

Please sign in to comment.