-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.server-alpine
35 lines (30 loc) · 1.01 KB
/
Dockerfile.server-alpine
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
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Dockerfile.server-alpine
#
# A simple http app that runs Lighthouse reports and returns the report in
# the response body. In contrast to the debian Dockerfile, this is based on
# a Chrome image -- slimmer and more reliable.
#
# 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
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FROM zenika/alpine-chrome:with-node
WORKDIR "/usr/src/app"
# Step 1: Delete sample app
RUN rm -rf *
# Step 1: Build app
COPY --chown=chrome:chrome package*.json ./
RUN npm i
COPY --chown=chrome:chrome src src
COPY --chown=chrome:chrome tsconfig.json server.js ./
RUN npx tsc
RUN ls -la
# Step 2: Clean build files
RUN rm -rf node_modules src tsconfig.json
# Step 3: Install production packages
RUN npm i --production
EXPOSE 8080
CMD [ "node", "server.js" ]