-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.server-debian
49 lines (38 loc) · 1.28 KB
/
Dockerfile.server-debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Dockerfile.server-debian
#
# A simple http app that runs Lighthouse reports and returns the report in
# the response body. In contrast to the alpine Dockerfile, this is based
# on the node image and installs Chrome manually.
#
# Status: Working
#
# ref: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
# ref: https://github.com/Zenika/alpine-chrome#run-examples
# ref: https://www.npmjs.com/package/aws-lambda-ric
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Define function directory
ARG FUNCTION_DIR="/usr/src/app"
FROM node:14.16.0-buster-slim
# Include global arg in this stage of the build
ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}
RUN apt update
RUN apt install -y wget
# Step 1: Install chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt install -y ./google-chrome-stable_current_amd64.deb
# Step 2: Build app
RUN rm -rf *
COPY package*.json ./
RUN npm i
COPY src src
COPY tsconfig.json server.js ./
RUN npx tsc
# Step 3: Cleanup
RUN rm -rf node_modules src mv tsconfig.json
RUN npm i --production
COPY server.js README.md ./
# TODO: Confirm not running as root and files are owned by node user
EXPOSE 8080
CMD [ "node", "server.js" ]