-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dockerfile
71 lines (55 loc) · 2.65 KB
/
main.dockerfile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
################################################################################
########## ██╗ ██╗███████╗██╗ ██╗██╗ ██╗ ##############
########## ██║ ██║██╔════╝██║ ██║╚██╗██╔╝ ##############
########## ███████║█████╗ ██║ ██║ ╚███╔╝ ##############
########## ██╔══██║██╔══╝ ██║ ██║ ██╔██╗ ##############
########## ██║ ██║███████╗███████╗██║██╔╝ ██╗ ##############
########## ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ ##############
################################################################################
# Docker image of Helix
# Based on Alpine Linux (https://hub.docker.com/_/alpine)
# and Node.js (https://hub.docker.com/_/node)
# Repository: https://github.com/Xavier2p/helix
# License: GPL-3.0
# Author: Xavier2p <contact.helix@skiff.com>
# Image published at: https://hub.docker.com/r/xavier2p/helix
################################################################################
# Builder from Node
################################################################################
FROM alpine:latest AS builder
RUN apk add --update npm
################################################################################
# Build Server
################################################################################
FROM builder AS builder-server
WORKDIR /app
# Install packages
COPY server/package*.json .
RUN npm clean-install
# Copy the builded server
COPY server/build ./
################################################################################
# Build Client
################################################################################
FROM builder AS builder-client
WORKDIR /app
# Install packages
COPY client/package*.json .
RUN npm install
# Copy the builded client
COPY client/dist ./
################################################################################
# Build Final Image
################################################################################
FROM alpine:latest AS production
WORKDIR /helix
# Install node
RUN apk add --update nodejs
# Copy the app
COPY --from=builder-server /app ./build
COPY --from=builder-server /app/node_modules ./node_modules
COPY --from=builder-client /app ./build/www
# Set the port
EXPOSE 3001
# Start the app
CMD [ "node", "build/server.js" ]