Skip to content
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

Patch 1 #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
68 changes: 68 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Builder image
#
# base image
FROM node:12.16 as builder



WORKDIR /home/node
#USER node

#COPY --chown=node:node ./package.json .
#COPY --chown=node:node ./package-lock.json .
ARG API_HOST=127.0.0.1:8081

ENV API_URL=$API_HOST

RUN echo ${API_URL}

COPY ./package.json .
COPY ./package-lock.json .

RUN npm install

#COPY --chown=node:node . ./
COPY . ./

RUN npm install -g envsub
RUN envsub ./src/assets/env.template.js ./src/assets/env.js
RUN npm remove -g envsub

RUN npm run build

# Removing development dependencies
RUN rm -r node_modules
# Install using production dependencies
RUN npm install --production; exit 0

# base image
FROM alpine:3.11.6



RUN apk add --no-cache nginx=1.16.1-r6 && \
rm -rf /var/cache/apk/*

# implement changes required to run NGINX as an unprivileged user
## Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*

# copy nginx configuration
COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf

RUN rm /etc/nginx/nginx.conf
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf


# copy artifact build from the 'build environment'
COPY --from=builder /home/node/dist/CatatumboApp3 /usr/share/nginx/html

#USER nginx
RUN mkdir /tmp/nginx

# expose port 3000
EXPOSE 3000

# run nginx
CMD ["nginx", "-g", "daemon off;"]