-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
70 lines (59 loc) · 2.25 KB
/
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
################################################
# Change Node Version as necessary
# https://hub.docker.com/_/node/tags
################################################
FROM node:18.16.0
################################################
# Install GIT Package
################################################
RUN apt-get update && apt-get install git -y
################################################
# Create & set working directory
################################################
RUN apt-get clean autoclean
RUN apt-get autoremove --yes
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/
################################################
# Using Bun as the package Manager
# !you can replace with any other package manager)
# !If changed then update the entry_point.sh script
################################################
RUN npm i -g bun
################################################
# Copying over the script that will be executed on
# starting the container
################################################
COPY ./entry_point.sh /entry_point.sh
RUN chmod +x /entry_point.sh
RUN chown node /entry_point.sh
################################################
# Copy repo to working directory
################################################
WORKDIR /app
COPY --chown=node:node webroot/ .
RUN chown node /app
################################################
# Copy ssh key to .ssh folder & set required
# file permissions & set user's group
################################################
RUN mkdir /home/node/.ssh
COPY .ssh/id_rsa /home/node/.ssh/id_rsa
COPY .ssh/id_rsa.pub /home/node/.ssh/id_rsa.pub
RUN chmod 600 /home/node/.ssh/id_rsa && chmod 600 /home/node/.ssh/id_rsa.pub
RUN ssh-keyscan gitlab.com >>/home/node/.ssh/known_hosts
RUN chown node -R /home/node
USER node
################################################
# Label Your Image
################################################
LABEL Name="My Next.js/NodeJs Server Image"
LABEL Version="1.0.0"
################################################
# Expose port(s) for external access
################################################
EXPOSE 8080
################################################
# Command to be executed when running a container
# from an image
################################################
CMD ["/entry_point.sh"]