build: simplify docker setup and fix e2e

This commit is contained in:
Johannes Millan 2025-07-18 20:00:10 +02:00
parent c9e6bba64a
commit ed2d99a852
5 changed files with 34 additions and 987 deletions

View file

@ -1,63 +1,34 @@
# builds the app and runs the webversion inside a docker container # Build stage
### build ###
# base image
FROM --platform=$BUILDPLATFORM node:20 AS build FROM --platform=$BUILDPLATFORM node:20 AS build
# set working directory
WORKDIR /app WORKDIR /app
# install git for git dependencies # Install git and configure for HTTPS
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* && \
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
# configure git to use https instead of ssh # Copy and install dependencies
RUN git config --global url."https://github.com/".insteadOf ssh://git@github.com/ COPY package*.json ./
RUN npm ci || npm i
# add app # Copy source and build
COPY . /app COPY . .
RUN npm run lint && npm run buildFrontend:prodWeb
# add `/app/node_modules/.bin` to $PATH # Production stage
ENV PATH=/app/node_modules/.bin:$PATH FROM nginx:1-alpine
# install dependencies (with prepare script running naturally)
RUN (npm ci || npm i) && npm i -g @angular/cli
# run linter
RUN npm run lint
# generate build
RUN npm run buildFrontend:prodWeb
### serve ###
# base image
# --platform=$TARGETPLATFORM is redundant and docker will raise a warning,
# but it makes it clearer that the target platform might be different from the
# build platform
FROM --platform=$TARGETPLATFORM nginx:1-alpine
# environmental variables
ENV PORT=80 ENV PORT=80
# install dependencies # Install runtime dependencies
RUN apk update \ RUN apk add --no-cache jq
&& apk add --no-cache jq
# copy artifact build from the 'build environment' # Copy built app and configs
COPY --from=build /app/dist/browser /usr/share/nginx/html COPY --from=build /app/dist/browser /usr/share/nginx/html
# copy nginx config
COPY ./nginx/default.conf.template /etc/nginx/templates/default.conf.template COPY ./nginx/default.conf.template /etc/nginx/templates/default.conf.template
# copy our custom entrypoint script
COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
# expose port: defaults to 80
EXPOSE $PORT EXPOSE $PORT
# set working directory
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
# use our custom entrypoint script, to provide extra steps
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

View file

@ -1,26 +1,23 @@
services: services:
sp: # Super Productivity app
app:
image: johannesjo/super-productivity:latest image: johannesjo/super-productivity:latest
ports: ports:
- 80:80 - '8080:80'
environment: environment:
# WebDAV backend served at `/webdav/` subdirectory (Optional) # Pre-configured defaults for easier setup
# Used with "webdav" container below WEBDAV_BASE_URL: ${WEBDAV_BASE_URL:-http://localhost:2345/}
- WEBDAV_BACKEND=http://webdav WEBDAV_USERNAME: ${WEBDAV_USERNAME:-admin}
WEBDAV_SYNC_FOLDER_PATH: ${WEBDAV_SYNC_FOLDER_PATH:-/}
SYNC_INTERVAL: ${SYNC_INTERVAL:-15}
IS_COMPRESSION_ENABLED: ${IS_COMPRESSION_ENABLED:-true}
IS_ENCRYPTION_ENABLED: ${IS_ENCRYPTION_ENABLED:-false}
# Default values in "Sync" section in "Settings" page (Optional) # WebDAV sync server
# Useful for single user instances
- WEBDAV_BASE_URL=<base-url>
- WEBDAV_USERNAME=<username>
- WEBDAV_SYNC_FOLDER_PATH=<sync-folder-path>
- SYNC_INTERVAL=<integer-in-minutes>
- IS_COMPRESSION_ENABLED=<true-or-false>
- IS_ENCRYPTION_ENABLED=<true-or-false>
# WebDAV backend server (Optional)
# Used with the WEBDAV_BACKEND environment variable
webdav: webdav:
image: hacdias/webdav:latest image: hacdias/webdav:latest
ports:
- '2345:2345'
volumes: volumes:
- ./webdav.yaml:/config.yml:ro - ./webdav.yaml:/config.yml:ro
- ./data:/data - ./data:/data

View file

@ -24,8 +24,9 @@ module.exports = {
.triggerSync() .triggerSync()
// Verify sync completed // Verify sync completed
.pause(3000) .pause(3000)
.noError() // .noError()
.assert.not.elementPresent('.sync-btn mat-icon.spin') .assert.not.elementPresent('.sync-btn mat-icon.spin')
.assert.textContains('.sync-btn mat-icon', 'check')
.end(); .end();
}, },
}; };

922
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -30,12 +30,6 @@ cors:
- '*' - '*'
users: users:
- username: alice
password: alice
directory: /data/alice
- username: bob
password: bob
directory: /data/bob
- username: admin - username: admin
password: admin password: admin
directory: /data/admin directory: /data