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 ###
# base image
# Build stage
FROM --platform=$BUILDPLATFORM node:20 AS build
# set working directory
WORKDIR /app
# install git for git dependencies
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Install git and configure for HTTPS
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
RUN git config --global url."https://github.com/".insteadOf ssh://git@github.com/
# Copy and install dependencies
COPY package*.json ./
RUN npm ci || npm i
# add app
COPY . /app
# Copy source and build
COPY . .
RUN npm run lint && npm run buildFrontend:prodWeb
# add `/app/node_modules/.bin` to $PATH
ENV PATH=/app/node_modules/.bin:$PATH
# Production stage
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
# install dependencies
RUN apk update \
&& apk add --no-cache jq
# Install runtime dependencies
RUN 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 nginx config
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
# expose port: defaults to 80
EXPOSE $PORT
# set working directory
WORKDIR /usr/share/nginx/html
# use our custom entrypoint script, to provide extra steps
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

View file

@ -1,26 +1,23 @@
services:
sp:
# Super Productivity app
app:
image: johannesjo/super-productivity:latest
ports:
- 80:80
- '8080:80'
environment:
# WebDAV backend served at `/webdav/` subdirectory (Optional)
# Used with "webdav" container below
- WEBDAV_BACKEND=http://webdav
# Pre-configured defaults for easier setup
WEBDAV_BASE_URL: ${WEBDAV_BASE_URL:-http://localhost:2345/}
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)
# 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 sync server
webdav:
image: hacdias/webdav:latest
ports:
- '2345:2345'
volumes:
- ./webdav.yaml:/config.yml:ro
- ./data:/data

View file

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

922
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

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