Skip to content

Commit

Permalink
integration files updates of hot-reload example
Browse files Browse the repository at this point in the history
  • Loading branch information
ibidani committed Feb 29, 2020
1 parent ba75094 commit 6bc189b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 20 deletions.
2 changes: 2 additions & 0 deletions integration/examples/hot-reload/k8s/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
labels:
app: node
spec:
securityContext:
runAsUser: 1000
containers:
- name: node
image: node-example
Expand Down
2 changes: 2 additions & 0 deletions integration/examples/hot-reload/k8s/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
labels:
app: python
spec:
securityContext:
runAsUser: 1000
containers:
- name: python
image: python-reload
Expand Down
17 changes: 11 additions & 6 deletions integration/examples/hot-reload/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM node:10.15.3-alpine
FROM node:12.16.0-alpine3.10

USER node
RUN mkdir /home/node/app
WORKDIR /home/node/app

WORKDIR /app
EXPOSE 3000
CMD ["npm", "run", "dev"]
ARG ENV=production
ENV NODE_ENV $ENV
CMD npm run $NODE_ENV

COPY package* ./
RUN chown -R 400:400 /app && npm ci
COPY src .
COPY --chown=node:node package* ./
RUN npm ci
COPY --chown=node:node . .
5 changes: 3 additions & 2 deletions integration/examples/hot-reload/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "src/index.js",
"scripts": {
"dev": "nodemon index.js"
"production": "node src/index.js",
"development": "nodemon src/index.js"
},
"dependencies": {
"express": "^4.16.4"
Expand Down
22 changes: 16 additions & 6 deletions integration/examples/hot-reload/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
FROM python:3.7.4-alpine3.10

RUN pip install --upgrade pip

RUN adduser -D python
USER python
WORKDIR /home/python

ARG DEBUG=0
ENV FLASK_DEBUG $DEBUG
ENV FLASK_APP=src/app.py
CMD ["python", "-m", "flask", "run", "--host=0.0.0.0"]
ENV FLASK_DEBUG=1
ENV FLASK_APP=app.py
WORKDIR /usr/src/app
COPY requirements.txt .
RUN chown -R 400:400 /usr/src/app && pip install -r requirements.txt
COPY src ./

COPY --chown=python:python requirements.txt .
ENV PATH="/home/python/.local/bin:${PATH}"
RUN pip install --user -r requirements.txt

COPY --chown=python:python src src
36 changes: 30 additions & 6 deletions integration/examples/hot-reload/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,35 @@ build:
artifacts:
- image: node-example
context: node
sync:
infer:
- 'src/**/*.js'

- image: python-reload
context: python
sync:
infer:
- 'src/**/*.py'

profiles:
- name: dev
activation:
- command: dev
build:
artifacts:
- image: node-example
context: node
docker:
buildArgs:
ENV: development
sync:
manual:
# Sync all the javascript files that are in the src folder
# with the container src folder
- src: 'src/**/*.js'
dest: .
- image: python-reload
context: python
docker:
buildArgs:
DEBUG: 1
sync:
manual:
# Sync all the javascript files that are in the src folder
# with the container src folder
- src: 'src/**/*.py'
dest: .

0 comments on commit 6bc189b

Please sign in to comment.