All Projects → ppdeassis → Docker Node Nginx Alpine

ppdeassis / Docker Node Nginx Alpine

Licence: unlicense
Dockerfile to build an image with Nginx and Node (npm and yarn) on Alpine Linux

Projects that are alternatives of or similar to Docker Node Nginx Alpine

Docker Lemp
🐳 Docker 快速搭建 LEMP 开发环境
Stars: ✭ 87 (+443.75%)
Mutual labels:  alpine, nginx
Dockerfiles
lots of dockerfiles, based on alpine
Stars: ✭ 69 (+331.25%)
Mutual labels:  alpine, nginx
Dockerfile
📦 Dockerfiles from WebDevOps for PHP, Apache and Nginx (with PHP5 and PHP7)
Stars: ✭ 1,169 (+7206.25%)
Mutual labels:  alpine, nginx
Docker Oidc Proxy
Docker Image built on Alpine Linux for secure OpenID Connect (OIDC) proxy authentication
Stars: ✭ 91 (+468.75%)
Mutual labels:  alpine, nginx
Uwsgi Nginx Flask Docker
Docker image with uWSGI and Nginx for Flask applications in Python running in a single container. Optionally with Alpine Linux.
Stars: ✭ 2,607 (+16193.75%)
Mutual labels:  alpine, nginx
Dockerfiles
Discontinued. Fork at your will.
Stars: ✭ 384 (+2300%)
Mutual labels:  alpine, nginx
Docker Php
🐳 Docker For PHP developers - Docker images with PHP, Nginx, OpenLiteSpeed, Apache, Lighttpd, and Alpine
Stars: ✭ 236 (+1375%)
Mutual labels:  alpine, nginx
Uwsgi Nginx Docker
Docker image with uWSGI and Nginx for applications in Python 3.5 and above and Python 2.7 (as Flask) in a single container. Optionally with Alpine Linux.
Stars: ✭ 466 (+2812.5%)
Mutual labels:  alpine, nginx
Images
Source code of images.weserv.nl, to be used on your own server(s).
Stars: ✭ 798 (+4887.5%)
Mutual labels:  nginx
K8s Elk Demo
A simple demonstration of the ELK stack on a Kubernetes cluster
Stars: ✭ 5 (-68.75%)
Mutual labels:  nginx
Hestiacp
Hestia Control Panel | A lightweight and powerful control panel for the modern web.
Stars: ✭ 764 (+4675%)
Mutual labels:  nginx
Nginx Demos
NGINX and NGINX Plus demos
Stars: ✭ 799 (+4893.75%)
Mutual labels:  nginx
Netboot Httpd
Docker container for serving netboot image over http. Use in combination with BSDPy
Stars: ✭ 5 (-68.75%)
Mutual labels:  nginx
Httperrorpages
⏩ Simple HTTP Error Page Generator
Stars: ✭ 772 (+4725%)
Mutual labels:  nginx
Amazon Scripts
Administrative scripts for my EC2 Amazon Linux based Meteor/Mongo/Nginx/Node/Passenger server
Stars: ✭ 6 (-62.5%)
Mutual labels:  nginx
Alpine Chrome
Chrome Headless docker images built upon alpine official image
Stars: ✭ 754 (+4612.5%)
Mutual labels:  alpine
Xray onekey
Xray 基于 Nginx 的 VLESS + XTLS 一键安装脚本
Stars: ✭ 7,012 (+43725%)
Mutual labels:  nginx
Vestacp nginx pagespeed http2
Rebuild Nginx with Google PageSpeed and http/2 for VestaCP
Stars: ✭ 16 (+0%)
Mutual labels:  nginx
Ffmpeg
Docker build for FFmpeg on Ubuntu / Alpine / Centos 7 / Scratch
Stars: ✭ 828 (+5075%)
Mutual labels:  alpine
Awesome Nginx
A curated list of awesome Nginx distributions, 3rd party modules, Active developers, etc.
Stars: ✭ 811 (+4968.75%)
Mutual labels:  nginx

docker-node-nginx-alpine

Dockerfile to build an image with Nginx and Node (npm and yarn) on Alpine Linux

Useful for deploying frontend services configurable by environment variables (runtime).

You can do something like:

FROM ppdeassis/node-nginx-alpine:latest

# lets install dependencies
WORKDIR /app
COPY . .
RUN rm -rf node_modules
RUN yarn install
RUN yarn cache clean

# starting: build the app (using env vars), update nginx conf and start nginx
CMD /bin/sh ./bin/docker-cmd.sh

Add a copy of bin/docker-cmd.sh to your project and customize it. And a copy of config/nginx.default.conf and customize it too.

With this, you can configure something like API_URL as an environment variable - at service runtime - making the images reusable with the tradeoff of being bigger (file size).

Building the image

docker build --tag node-nginx-alpine .

Running as a simple container

docker run -it --rm --publish 80:80 --name node-nginx-alpine node-nginx-alpine:latest

Alternative

Docker multi-stage builds, which requires a new build for every configuration (like API_URL). Check this references for more details:

A sample Dockerfile for multi-stage build:

# builder container
#   - builds the frontend app (Vue, React, Webpack, ...)

# Use an official node image
FROM node:9-alpine AS builder

# Reads args and use them to configure the build, setting
# them as env vars
ARG NODE_ENV
ARG API_URL

ENV NODE_ENV $NODE_ENV
ENV API_URL $API_URL

WORKDIR /app

# Install dependencies
COPY . .
RUN rm -rf node_modules
RUN yarn install
RUN yarn cache clean

RUN yarn run build


# ---


# runner container
#  - nginx, to serve static built Vue app

# Use an official nginx image
FROM nginx:1.13-alpine

# COPY dist from builder container to nginx html dir
COPY --from=builder /app/dist /usr/share/nginx/html

COPY config/nginx.default.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

# No need for CMD. It'll fallback to nginx image's one, which

You can build it with something like:

docker build --build-arg NODE_ENV=development --build-arg API_URL=https://api.example.com
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].