web/Dockerfile

32 lines · 1786 bytes

 1###############################################################################
 2# A lightweight, non-root, multi-stage, cross-architecture Dockerfile         #
 3# That you can use in order to easily deploy Awesome Privacy to any server    #
 4# For docs visit the GitHub repo: https://github.com/lissy93/awesome-privacy  # 
 5# Licensed under MIT (C) Alicia Sykes <https://aliciasykes.com> 2024          #
 6###############################################################################
 7# Usage:                                                                      #
 8# Step 1: Build the Docker image                                              #
 9# docker build -t awesome-privacy .                                           #
10#                                                                             #
11# Step 2: Run the Docker container                                            #
12# docker run -p 8080:80 awesome-privacy                                       #
13#                                                                             #
14# Step 3: Access the running app                                              #
15# Open your browser and navigate to http://127.0.0.1:8080                     #
16###############################################################################
17
18# Stage 1: Build the app (Alpine + Node.js)
19# Copies manifest and src files from host, installs deps, and builds the app
20FROM node:16-alpine as build
21WORKDIR /app
22COPY package.json yarn.lock .env* ./
23RUN yarn install --frozen-lockfile
24COPY . .
25RUN yarn build
26
27# Stage 2: Serve the app (Alpine + NGINX)
28# Copies dist from the previous stage, exposes port 80, and starts web server
29FROM nginx:alpine as runtime
30COPY --from=build /app/dist /usr/share/nginx/html
31EXPOSE 80
32CMD ["nginx", "-g", "daemon off;"]