Skip to content

Commit

Permalink
Revert "perf(docker): optimize cypress tests"
Browse files Browse the repository at this point in the history
This reverts commit 9a3bd72.
  • Loading branch information
dargmuesli committed Feb 21, 2023
1 parent a3afc6e commit 9da9d76
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
3 changes: 0 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,5 @@ cypress/snapshots/diff
cypress/snapshots/result
cypress/videos

# Docker
Dockerfile

# Nuxt
.output
57 changes: 28 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,55 +87,55 @@ ARG GID=1000

WORKDIR /srv/app/

RUN cp /usr/local/bin/cypress /root/.cache/Cypress \
# Update and install dependencies.
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
# `curl ca-certificates libnss3-tools` are required by `mkcert`
curl ca-certificates libnss3-tools \
# pnpm
&& npm install -g pnpm \
# user
&& groupadd -g $GID -o $UNAME \
&& useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME \
# mkcert
&& curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" \
&& chmod +x mkcert-v*-linux-amd64 \
&& cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert \
&& mkcert -install \
# clean
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& cypress verify
&& rm -rf /var/lib/apt/lists/*

USER $UNAME

VOLUME /srv/app


########################
# Nuxt: test (integration, development)
# Nuxt: test (integration)

# Should be the specific version of `cypress/included`.
FROM cypress/included:12.5.1@sha256:5cd0a6192ccf93739ce8c1f080ead0d6058eab991bc093a15adcf1c34e443972 AS test-integration-dev
FROM cypress/included:12.5.1@sha256:5cd0a6192ccf93739ce8c1f080ead0d6058eab991bc093a15adcf1c34e443972 AS test-integration

RUN cp /usr/local/bin/cypress /root/.cache/Cypress \
# Update and install dependencies.
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
# `curl ca-certificates libnss3-tools` are required by `mkcert`
curl ca-certificates libnss3-tools \
# pnpm
&& npm install -g pnpm

WORKDIR /srv/app/

COPY --from=prepare /srv/app/ ./

RUN pnpm test:integration:dev


########################
# Nuxt: test (integration, production)

# Should be the specific version of `cypress/included`.
FROM cypress/included:12.5.1@sha256:5cd0a6192ccf93739ce8c1f080ead0d6058eab991bc093a15adcf1c34e443972 AS test-integration-prod
&& npm install -g pnpm \
# mkcert
&& curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" \
&& chmod +x mkcert-v*-linux-amd64 \
&& cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert

RUN cp /usr/local/bin/cypress /root/.cache/Cypress \
# pnpm
&& npm install -g pnpm
COPY --from=prepare /root/.cache/Cypress /root/.cache/Cypress
COPY --from=build /srv/app/ /srv/app/

WORKDIR /srv/app/

COPY --from=build /srv/app/ /srv/app/
COPY --from=test-integration-dev /srv/app/package.json /tmp/test/package.json

RUN pnpm test:integration:prod
RUN pnpm test:integration:prod \
&& pnpm test:integration:dev


#######################
Expand All @@ -148,8 +148,7 @@ WORKDIR /srv/app/

COPY --from=build /srv/app/.output ./.output
COPY --from=lint /srv/app/package.json /tmp/lint/package.json
COPY --from=test-integration-dev /srv/app/package.json /tmp/test/package.json
COPY --from=test-integration-prod /srv/app/package.json /tmp/test/package.json
COPY --from=test-integration /srv/app/package.json /tmp/test/package.json


#######################
Expand Down

0 comments on commit 9da9d76

Please sign in to comment.