Skip to content

Commit 0453f50

Browse files
committed
Dockerfile modified and workflow created
1 parent 2833299 commit 0453f50

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: GitHub Actions Demo
2+
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
3+
on: [push]
4+
jobs:
5+
Explore-GitHub-Actions:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
9+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
10+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
11+
- name: Check out repository code
12+
uses: actions/checkout@v5
13+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
14+
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
15+
- name: List files in the repository
16+
run: |
17+
ls ${{ github.workspace }}
18+
- run: echo "🍏 This job's status is ${{ job.status }}."

Dockerfile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,31 @@ USER node
2727
###RUN ###
2828
FROM alpine:3.20 AS runner
2929

30+
# Chemin de travail
31+
WORKDIR /app
32+
33+
# Installation de Node.js runtime
34+
RUN apk add --no-cache nodejs
35+
36+
# Création de l'utilisateur et groupe node
37+
RUN addgroup -S node && adduser -S node -G node
38+
39+
40+
# Copie uniquement des fichiers nécessaires depuis builder
41+
COPY --from=builder --chown=node:node /app/dist ./dist
42+
COPY --from=builder --chown=node:node /app/package*.json ./
43+
44+
# Installation des dépendances de production uniquement
45+
RUN apk add --no-cache npm && \
46+
npm ci --only=production && \
47+
npm cache clean --force && \
48+
apk del npm && \
49+
rm -rf /tmp/*
50+
51+
# Downgrade des privilèges
52+
USER node
53+
3054
# exposition du port
3155
EXPOSE 8000
3256
# exécution
33-
CMD ["node", "dist/index.js"]
34-
COPY --from=builder --chown=node:node /app ./app
57+
CMD ["node", "dist/index.js"]

0 commit comments

Comments
 (0)