Spaces:
Running
Running
Vlad Cepesh
commited on
Commit
•
fb724d4
1
Parent(s):
fac8b4b
Create Dockerfile
Browse files- Dockerfile +28 -0
Dockerfile
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:18-bullseye-slim
|
2 |
+
|
3 |
+
# Install Git
|
4 |
+
RUN apt-get update && \
|
5 |
+
apt-get install -y git
|
6 |
+
|
7 |
+
# Clone the repository into the /app directory
|
8 |
+
RUN --mount=type=secret,id=GITHUB_SSH_KEY,mode=0444,required=true \
|
9 |
+
--mount=type=secret,id=GIT_LINK \
|
10 |
+
git config --global credential.helper '!f() { echo "username=$(cat /run/secrets/GITHUB_SSH_KEY)\npassword=$(cat /run/secrets/GITHUB_SSH_KEY)"; }; f' && \
|
11 |
+
git clone $(cat /run/secrets/GIT_LINK) /app
|
12 |
+
WORKDIR /app
|
13 |
+
|
14 |
+
# Install dependencies
|
15 |
+
RUN npm install
|
16 |
+
COPY Dockerfile greeting.md* .env* ./
|
17 |
+
|
18 |
+
# Copy files for build and build the app
|
19 |
+
RUN npm run build
|
20 |
+
|
21 |
+
# Expose the app's port
|
22 |
+
EXPOSE 7860
|
23 |
+
|
24 |
+
# Set the NODE_ENV environment variable to production
|
25 |
+
ENV NODE_ENV=production
|
26 |
+
|
27 |
+
# Start the app
|
28 |
+
CMD [ "npm", "start" ]
|