File tree Expand file tree Collapse file tree 7 files changed +55
-16
lines changed
{{cookiecutter.project_dirname}} Expand file tree Collapse file tree 7 files changed +55
-16
lines changed Original file line number Diff line number Diff line change
1
+ # consumer
1
2
COMPOSE_FILE=docker-compose.yaml:docker-compose/local.yaml
2
3
COMPOSE_PROFILES=pact
3
- # CYPRESS_BASE_URL=https://proxy:8443
4
4
# INTERNAL_BACKEND_URL=http://provider:8000
5
5
# NEXT_PUBLIC_PROJECT_URL=https://localhost:8443
6
6
# REACT_ENVIRONMENT=development
7
7
# SERVICE_DOCKER_FILE=docker/local.Dockerfile
8
+ # cypress
9
+ # CYPRESS_BASE_URL=https://proxy:8443
10
+ # user
11
+ # GROUP_ID=1000
12
+ # USER_ID=1000
13
+ # USER=appuser
Original file line number Diff line number Diff line change @@ -134,19 +134,20 @@ test:
134
134
- docker:20-dind
135
135
needs : []
136
136
variables :
137
- COMPOSE_FILE : docker-compose.yaml:docker-compose/local .yaml
137
+ COMPOSE_FILE : docker-compose.yaml:docker-compose/test .yaml
138
138
COMPOSE_PROJECT_NAME : " ${CI_PROJECT_PATH_SLUG}-${CI_JOB_NAME}-${CI_JOB_ID}"
139
139
SERVICE_CONTAINER_NAME : " ${CI_PROJECT_PATH_SLUG}-${CI_JOB_NAME}-${CI_JOB_ID}_frontend"
140
140
SERVICE_DOCKER_FILE : " docker/test.Dockerfile"
141
141
SERVICE_IMAGE_NAME : " gitlabci_{{ cookiecutter.project_slug }}_{{ cookiecutter.service_slug }}"
142
142
SERVICE_IMAGE_TAG : " ${CI_JOB_NAME}-${CI_JOB_ID}"
143
143
before_script :
144
- - export COMPOSE_FILE=docker-compose/consumer.yaml:docker-compose/volumes.yaml
145
144
- mkdir pacts
146
145
script :
147
146
- docker-compose build --quiet consumer
148
147
- docker-compose run --name ${SERVICE_CONTAINER_NAME} consumer
149
148
after_script :
149
+ - docker cp ${SERVICE_CONTAINER_NAME}:/app/coverage .
150
+ - docker cp ${SERVICE_CONTAINER_NAME}:/app/pacts .
150
151
- docker-compose down --volumes --remove-orphans
151
152
coverage : /All files[^|]*\|[^|]*\s+([\d\.]+)/
152
153
artifacts :
Original file line number Diff line number Diff line change @@ -4,7 +4,12 @@ services:
4
4
5
5
consumer :
6
6
build :
7
+ args :
8
+ GROUP_ID : ${GROUP_ID:-1000}
9
+ USER_ID : ${USER_ID:-1000}
10
+ USER : ${USER:-appuser}
7
11
context : ./
8
12
dockerfile : ${SERVICE_DOCKER_FILE:-docker/local.Dockerfile}
9
13
volumes :
10
14
- ./:/app
15
+ - /app/node_modules
Original file line number Diff line number Diff line change
1
+ version : " 3.9"
2
+
3
+ services :
4
+
5
+ consumer :
6
+ build :
7
+ args :
8
+ USER : ${USER:-nextjs}
9
+ context : ./
10
+ dockerfile : ${SERVICE_DOCKER_FILE:-docker/test.Dockerfile}
11
+ volumes :
12
+ - ./__tests__:/app/__tests__:ro
13
+ - ./components:/app/components:ro
14
+ - ./declarations:/app/declarations:ro
15
+ - ./models:/app/models:ro
16
+ - ./pages:/app/pages:ro
17
+ - ./public:/app/public:ro
18
+ - ./store:/app/store:ro
19
+ - ./styles:/app/styles:ro
20
+ - ./utils:/app/utils:ro
21
+ user : ${USER:-nextjs}
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
# syntax=docker/dockerfile:1
2
2
3
3
FROM node:16-bullseye-slim
4
- ARG DEBIAN_FRONTEND=noninteractive
5
- ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 NEXT_TELEMETRY_DISABLED=1 NODE_ENV="development" WORKDIR=/app
4
+ ARG DEBIAN_FRONTEND=noninteractive GROUP_ID=1000 USER_ID=1000 USER=appuser
5
+ ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 NEXT_TELEMETRY_DISABLED=1 NODE_ENV="development" USER=$USER WORKDIR=/app
6
6
RUN apt-get update \
7
7
&& apt-get install --assume-yes --no-install-recommends \
8
8
g++ \
@@ -11,15 +11,18 @@ RUN apt-get update \
11
11
openssh-client \
12
12
python3 \
13
13
wget \
14
- && rm -rf /var/lib/apt/lists/*
14
+ && rm -rf /var/lib/apt/lists/*
15
15
WORKDIR /
16
16
COPY --chown=node ./package.json ./
17
17
COPY --chown=node ./yarn.lock ./
18
18
RUN yarn install
19
- USER node
20
19
ENV PATH="/node_modules/.bin:${PATH}"
21
- WORKDIR ${WORKDIR}
22
- RUN chown node ${WORKDIR}
20
+ RUN userdel -r node
21
+ RUN addgroup --system --gid $GROUP_ID $USER
22
+ RUN adduser --system --uid $USER_ID $USER
23
+ WORKDIR $WORKDIR
24
+ RUN chown $USER_ID:$GROUP_ID $WORKDIR
25
+ USER $USER_ID:$GROUP_ID
23
26
ENTRYPOINT ["./scripts/entrypoint.sh" ]
24
27
CMD yarn start
25
28
LABEL company="20tab" project="{{ cookiecutter.project_slug }}" service="frontend" stage="local"
Original file line number Diff line number Diff line change 1
1
# syntax=docker/dockerfile:1
2
2
3
3
FROM node:16-bullseye-slim
4
- ARG DEBIAN_FRONTEND=noninteractive
5
- ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 NEXT_TELEMETRY_DISABLED=1 NODE_ENV="development" TZ='Europe/Rome' WORKDIR=/app
4
+ ARG DEBIAN_FRONTEND=noninteractive USER=appuser
5
+ ENV APPUSER=$USER LANG=C.UTF-8 LC_ALL=C.UTF-8 NEXT_TELEMETRY_DISABLED=1 NODE_ENV="development" PATH= "$PATH:./node_modules/.bin " TZ='Europe/Rome' WORKDIR=/app
6
6
RUN apt-get update \
7
7
&& apt-get install --assume-yes --no-install-recommends \
8
8
g++ \
9
9
make \
10
10
python3 \
11
- && rm -rf /var/lib/apt/lists/*
11
+ && rm -rf /var/lib/apt/lists/*
12
12
WORKDIR $WORKDIR
13
- ENV PATH="$PATH:./node_modules/.bin"
14
- COPY package.json yarn.lock ./
15
- ENTRYPOINT ["./scripts/test.sh" ]
16
- CMD yarn ci:unit-test && yarn ci:contract-test
13
+ RUN addgroup --system --gid 1001 $APPUSER
14
+ RUN adduser --system --uid 1001 $APPUSER
15
+ RUN chown $APPUSER:$APPUSER $WORKDIR
16
+ USER $APPUSER
17
+ COPY --chown=$APPUSER ./scripts/test.sh jest.config.js middleware.ts next.config.js package.json tsconfig.json yarn.lock ./
18
+ ENTRYPOINT ["./test.sh" ]
19
+ CMD yarn ci:contract-test && yarn ci:unit-test
17
20
LABEL company="20tab" project="{{ cookiecutter.project_slug }}" service="frontend" stage="test"
You can’t perform that action at this time.
0 commit comments