diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72cb3ee6e..88e5582f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ stages: review_front: interruptible: true stage: review - image: node:16-buster + image: node:16-alpine when: manual allow_failure: true variables: @@ -34,8 +34,7 @@ review_front: VUE_APP_INSTANCE_URL: $REVIEW_INSTANCE_URL NODE_ENV: review before_script: - - curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 - - chmod +x /usr/local/bin/jq + - apk add --no-cache jq bash coreutils python3 - rm -rf front-review - mkdir front-review - cd front @@ -118,7 +117,7 @@ changelog_snippet: black: interruptible: true - image: python:3.6 + image: python:3.10 stage: lint variables: GIT_STRATEGY: fetch @@ -129,7 +128,7 @@ black: flake8: interruptible: true - image: python:3.6 + image: python:3.7 stage: lint variables: GIT_STRATEGY: fetch @@ -144,10 +143,11 @@ flake8: eslint: interruptible: true - image: node:16-buster + image: node:16-alpine stage: lint before_script: - cd front + - apk add --no-cache jq bash coreutils python3 - yarn install script: - yarn lint --max-warnings 0 @@ -159,8 +159,8 @@ eslint: test_api: interruptible: true services: - - postgres:14 - - redis:6 + - postgres:14-alpine + - redis:7-alpine stage: test retry: 1 cache: @@ -199,9 +199,10 @@ test_api: test_front: interruptible: true stage: test - image: node:16-buster + image: node:16-alpine before_script: - cd front + - apk add --no-cache jq bash coreutils python3 only: refs: - branches @@ -226,8 +227,8 @@ build_docs: stage: build image: $CI_REGISTRY/funkwhale/backend-test-docker:3.10 services: - - postgres:14 - - redis:6 + - postgres:14-alpine + - redis:7-alpine cache: key: "$CI_PROJECT_ID__pip_cache" paths: @@ -254,10 +255,9 @@ build_docs: build_front: stage: build - image: node:16-buster + image: node:16-alpine before_script: - - curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 - - chmod +x /usr/local/bin/jq + - apk add --no-cache jq bash coreutils python3 - cd front script: - yarn install diff --git a/api/.dockerignore b/api/.dockerignore index eaf79bde9..2de0d12d8 100644 --- a/api/.dockerignore +++ b/api/.dockerignore @@ -67,3 +67,4 @@ mailhog *.sqlite3 music media +data diff --git a/api/Dockerfile b/api/Dockerfile index af56f29bb..d4180576f 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -40,8 +40,8 @@ RUN python -m venv --system-site-packages /venv # emulate activation by prefixing PATH ENV PATH="/venv/bin:/root/.local/bin:$PATH" VIRTUAL_ENV=/venv -COPY --from=0 /requirements.txt /requirements.txt -COPY --from=0 /dev-requirements.txt /dev-requirements.txt +COPY --from=pre-build /requirements.txt /requirements.txt +COPY --from=pre-build /dev-requirements.txt /dev-requirements.txt # hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072 ENV PIP_DOWNLOAD_CACHE=/noop/ RUN \ diff --git a/changes/changelog.d/1796.enhancement b/changes/changelog.d/1796.enhancement new file mode 100644 index 000000000..b4833dc80 --- /dev/null +++ b/changes/changelog.d/1796.enhancement @@ -0,0 +1 @@ +Cleanup Gitlab CI and Dockerfiles (!1796) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 5f048540b..990b65379 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -3,29 +3,23 @@ version: "3" services: postgres: restart: unless-stopped - networks: - - default env_file: .env environment: - "POSTGRES_HOST_AUTH_METHOD=trust" - image: postgres:14 + image: postgres:14-alpine volumes: - ./data/postgres:/var/lib/postgresql/data redis: restart: unless-stopped - networks: - - default env_file: .env - image: redis:6 + image: redis:7-alpine volumes: - ./data/redis:/data celeryworker: restart: unless-stopped image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - networks: - - default depends_on: - postgres - redis @@ -48,8 +42,6 @@ services: celerybeat: restart: unless-stopped image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - networks: - - default depends_on: - postgres - redis @@ -59,8 +51,6 @@ services: api: restart: unless-stopped image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - networks: - - default depends_on: - postgres - redis @@ -75,8 +65,6 @@ services: front: restart: unless-stopped image: funkwhale/front:${FUNKWHALE_VERSION:-latest} - networks: - - default depends_on: - api env_file: @@ -97,6 +85,3 @@ services: ports: # override those variables in your .env file if needed - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" - -networks: - default: diff --git a/dev.yml b/dev.yml index 5018310c0..1ffe83a3e 100644 --- a/dev.yml +++ b/dev.yml @@ -25,7 +25,7 @@ services: env_file: - .env.dev - .env - image: postgres:${POSTGRES_VERSION-11} + image: postgres:${POSTGRES_VERSION-11}-alpine environment: - "POSTGRES_HOST_AUTH_METHOD=trust" command: postgres ${POSTGRES_ARGS-} @@ -38,7 +38,7 @@ services: env_file: - .env.dev - .env - image: redis:5 + image: redis:7-alpine volumes: - "./data/${COMPOSE_PROJECT_NAME-node1}/redis:/data" networks: @@ -48,11 +48,12 @@ services: env_file: - .env.dev - .env - build: &backend + build: context: ./api dockerfile: Dockerfile args: install_dev_deps: 1 + image: funkwhale-api entrypoint: compose/django/dev-entrypoint.sh command: > bash -c "python manage.py collectstatic --no-input @@ -91,7 +92,7 @@ services: env_file: - .env.dev - .env - build: *backend + image: funkwhale-api depends_on: - postgres # - minio diff --git a/front/Dockerfile b/front/Dockerfile index 7dd32df34..4663d4c2c 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16 as builder +FROM node:16-alpine as builder WORKDIR /app COPY package.json yarn.lock /app/ @@ -7,6 +7,7 @@ COPY scripts /app/scripts COPY public /app/public COPY vite.config.js index.html embed.html /app/ +RUN apk add --no-cache jq bash coreutils python3 RUN yarn install RUN yarn build:deployment diff --git a/front/Dockerfile.dev b/front/Dockerfile.dev index 5493e4bbc..e108eb0c1 100644 --- a/front/Dockerfile.dev +++ b/front/Dockerfile.dev @@ -1,7 +1,7 @@ -FROM node:16-buster +FROM node:16-alpine # needed to compile translations -RUN apt-get update && apt-get install -y jq +RUN apk add --no-cache jq bash coreutils python3 EXPOSE 8080 WORKDIR /app/