Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
camino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
pnm-public
camino
Commits
e48f7042
Unverified
Commit
e48f7042
authored
2 years ago
by
BITARD Michaël
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
chore(infra): la ci build l'api en parallèle (#291)
parent
2977acb8
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.dockerignore
+5
-0
5 additions, 0 deletions
.dockerignore
.github/workflows/api.yml
+15
-1
15 additions, 1 deletion
.github/workflows/api.yml
Dockerfile.api
+10
-41
10 additions, 41 deletions
Dockerfile.api
Makefile
+3
-3
3 additions, 3 deletions
Makefile
with
33 additions
and
45 deletions
.dockerignore
+
5
−
0
View file @
e48f7042
...
...
@@ -9,3 +9,8 @@ infra/cd/.cargo_docker
infra/cd/target
packages/api/backups
packages/api/sources
packages/api/files
packages/api/api-cache
packages/api/coverage
packages/api/docs
packages/ui/coverage
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.github/workflows/api.yml
+
15
−
1
View file @
e48f7042
...
...
@@ -12,6 +12,20 @@ on:
description
:
'
le
token
docker'
required
:
true
jobs
:
type
:
runs-on
:
ubuntu-latest
steps
:
-
name
:
Checkout
uses
:
actions/checkout@v3
-
name
:
Use Node.js
uses
:
actions/setup-node@v3
with
:
node-version
:
'
19.1'
cache
:
'
npm'
-
name
:
Npm install
run
:
make install
-
name
:
Build
run
:
make build/api
lint
:
runs-on
:
ubuntu-latest
steps
:
...
...
@@ -85,7 +99,7 @@ jobs:
token
:
${{ secrets.CODECOV_TOKEN }}
flags
:
api-integration, api
build
:
needs
:
[
unit-test
,
integration-test
,
lint
]
needs
:
[
unit-test
,
integration-test
,
lint
,
type
]
runs-on
:
ubuntu-latest
steps
:
...
...
This diff is collapsed.
Click to expand it.
Dockerfile.api
+
10
−
41
View file @
e48f7042
FROM node:19.1-alpine
as build-stage
WORKDIR /
app
FROM node:19.1-alpine
WORKDIR /
RUN apk add make
COPY package*.json /app/
COPY packages/common/package.json /app/packages/common/package.json
COPY packages/api/package.json /app/packages/api/package.json
COPY Makefile /app/Makefile
RUN CI=true make install
COPY ./ /app/
RUN npm run build -w packages/api && \
rm -rf /app/node_modules/ && \
rm -rf /app/packages/api/node_modules/ && \
rm -rf /app/packages/ui/node_modules/ && \
rm -rf /app/packages/common/node_modules/ && \
CI=true make install/prod
FROM node:19.1-alpine as production-stage
# TODO 2022-07-13 : on profite que
# - l'utilisateur a le même id sur toutes les machines
# - ansible crée les dossiers avec les bons droits
RUN apk add make && adduser -u 1002 -D nonroot
USER nonroot
COPY --chown=nonroot:nonroot --from=build-stage /app/package.json ./
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/api/package.json ./packages/api/
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/common/package.json ./packages/common/
COPY --chown=nonroot:nonroot --from=build-stage /app/node_modules ./node_modules/
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/api/node_modules /packages/api/node_modules/
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/api/src ./packages/api/src/
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/api/tsconfig.json ./packages/api/
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/common/src ./packages/common/src/
COPY --chown=nonroot:nonroot --from=build-stage /app/packages/common/tsconfig.json ./packages/common/
COPY --chown=nonroot:nonroot Makefile .
# Ce n'est pas nécessaire pour les environnements de prod (le dossier est crée par ansible et monté) mais est plus correct pour pouvoir utiliser l'image sans problème de droit au démarrage
RUN mkdir -p /packages/api/files
CMD ["make", "start/api"]
COPY ./package-lock.json /
COPY ./Makefile /Makefile
COPY ./package.json /
COPY ./packages/api/ /packages/api
COPY ./packages/common/ /packages/common
RUN CI=true make install/prod
ENTRYPOINT ["make", "start/api"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Makefile
+
3
−
3
View file @
e48f7042
...
...
@@ -52,16 +52,16 @@ endif
install
:
ifdef
CI
npm
set-script prepare
""
npm
pkg delete scripts
endif
npm ci
install/prod
:
ifdef
CI
npm
set-script prepare
""
npm
pkg delete scripts
endif
npm ci
--o
nly
=
prod
npm ci
--o
mit
=
dev
build
:
build/common build/api build/ui
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment