Cleanup Gitlab CI and Dockerfiles

This commit is contained in:
JuniorJPDJ 2022-07-10 19:31:37 +02:00 committed by Georg Krause
parent 622369c62b
commit 96c2eacb0f
8 changed files with 29 additions and 40 deletions

View File

@ -25,7 +25,7 @@ stages:
review_front: review_front:
interruptible: true interruptible: true
stage: review stage: review
image: node:16-buster image: node:16-alpine
when: manual when: manual
allow_failure: true allow_failure: true
variables: variables:
@ -34,8 +34,7 @@ review_front:
VUE_APP_INSTANCE_URL: $REVIEW_INSTANCE_URL VUE_APP_INSTANCE_URL: $REVIEW_INSTANCE_URL
NODE_ENV: review NODE_ENV: review
before_script: before_script:
- curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 - apk add --no-cache jq bash coreutils python3
- chmod +x /usr/local/bin/jq
- rm -rf front-review - rm -rf front-review
- mkdir front-review - mkdir front-review
- cd front - cd front
@ -118,7 +117,7 @@ changelog_snippet:
black: black:
interruptible: true interruptible: true
image: python:3.6 image: python:3.10
stage: lint stage: lint
variables: variables:
GIT_STRATEGY: fetch GIT_STRATEGY: fetch
@ -129,7 +128,7 @@ black:
flake8: flake8:
interruptible: true interruptible: true
image: python:3.6 image: python:3.7
stage: lint stage: lint
variables: variables:
GIT_STRATEGY: fetch GIT_STRATEGY: fetch
@ -144,10 +143,11 @@ flake8:
eslint: eslint:
interruptible: true interruptible: true
image: node:16-buster image: node:16-alpine
stage: lint stage: lint
before_script: before_script:
- cd front - cd front
- apk add --no-cache jq bash coreutils python3
- yarn install - yarn install
script: script:
- yarn lint --max-warnings 0 - yarn lint --max-warnings 0
@ -159,8 +159,8 @@ eslint:
test_api: test_api:
interruptible: true interruptible: true
services: services:
- postgres:14 - postgres:14-alpine
- redis:6 - redis:7-alpine
stage: test stage: test
retry: 1 retry: 1
cache: cache:
@ -199,9 +199,10 @@ test_api:
test_front: test_front:
interruptible: true interruptible: true
stage: test stage: test
image: node:16-buster image: node:16-alpine
before_script: before_script:
- cd front - cd front
- apk add --no-cache jq bash coreutils python3
only: only:
refs: refs:
- branches - branches
@ -226,8 +227,8 @@ build_docs:
stage: build stage: build
image: $CI_REGISTRY/funkwhale/backend-test-docker:3.10 image: $CI_REGISTRY/funkwhale/backend-test-docker:3.10
services: services:
- postgres:14 - postgres:14-alpine
- redis:6 - redis:7-alpine
cache: cache:
key: "$CI_PROJECT_ID__pip_cache" key: "$CI_PROJECT_ID__pip_cache"
paths: paths:
@ -254,10 +255,9 @@ build_docs:
build_front: build_front:
stage: build stage: build
image: node:16-buster image: node:16-alpine
before_script: before_script:
- curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 - apk add --no-cache jq bash coreutils python3
- chmod +x /usr/local/bin/jq
- cd front - cd front
script: script:
- yarn install - yarn install

View File

@ -67,3 +67,4 @@ mailhog
*.sqlite3 *.sqlite3
music music
media media
data

View File

@ -40,8 +40,8 @@ RUN python -m venv --system-site-packages /venv
# emulate activation by prefixing PATH # emulate activation by prefixing PATH
ENV PATH="/venv/bin:/root/.local/bin:$PATH" VIRTUAL_ENV=/venv ENV PATH="/venv/bin:/root/.local/bin:$PATH" VIRTUAL_ENV=/venv
COPY --from=0 /requirements.txt /requirements.txt COPY --from=pre-build /requirements.txt /requirements.txt
COPY --from=0 /dev-requirements.txt /dev-requirements.txt COPY --from=pre-build /dev-requirements.txt /dev-requirements.txt
# hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072 # hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072
ENV PIP_DOWNLOAD_CACHE=/noop/ ENV PIP_DOWNLOAD_CACHE=/noop/
RUN \ RUN \

View File

@ -0,0 +1 @@
Cleanup Gitlab CI and Dockerfiles (!1796)

View File

@ -3,29 +3,23 @@ version: "3"
services: services:
postgres: postgres:
restart: unless-stopped restart: unless-stopped
networks:
- default
env_file: .env env_file: .env
environment: environment:
- "POSTGRES_HOST_AUTH_METHOD=trust" - "POSTGRES_HOST_AUTH_METHOD=trust"
image: postgres:14 image: postgres:14-alpine
volumes: volumes:
- ./data/postgres:/var/lib/postgresql/data - ./data/postgres:/var/lib/postgresql/data
redis: redis:
restart: unless-stopped restart: unless-stopped
networks:
- default
env_file: .env env_file: .env
image: redis:6 image: redis:7-alpine
volumes: volumes:
- ./data/redis:/data - ./data/redis:/data
celeryworker: celeryworker:
restart: unless-stopped restart: unless-stopped
image: funkwhale/api:${FUNKWHALE_VERSION:-latest} image: funkwhale/api:${FUNKWHALE_VERSION:-latest}
networks:
- default
depends_on: depends_on:
- postgres - postgres
- redis - redis
@ -48,8 +42,6 @@ services:
celerybeat: celerybeat:
restart: unless-stopped restart: unless-stopped
image: funkwhale/api:${FUNKWHALE_VERSION:-latest} image: funkwhale/api:${FUNKWHALE_VERSION:-latest}
networks:
- default
depends_on: depends_on:
- postgres - postgres
- redis - redis
@ -59,8 +51,6 @@ services:
api: api:
restart: unless-stopped restart: unless-stopped
image: funkwhale/api:${FUNKWHALE_VERSION:-latest} image: funkwhale/api:${FUNKWHALE_VERSION:-latest}
networks:
- default
depends_on: depends_on:
- postgres - postgres
- redis - redis
@ -75,8 +65,6 @@ services:
front: front:
restart: unless-stopped restart: unless-stopped
image: funkwhale/front:${FUNKWHALE_VERSION:-latest} image: funkwhale/front:${FUNKWHALE_VERSION:-latest}
networks:
- default
depends_on: depends_on:
- api - api
env_file: env_file:
@ -97,6 +85,3 @@ services:
ports: ports:
# override those variables in your .env file if needed # override those variables in your .env file if needed
- "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80"
networks:
default:

View File

@ -25,7 +25,7 @@ services:
env_file: env_file:
- .env.dev - .env.dev
- .env - .env
image: postgres:${POSTGRES_VERSION-11} image: postgres:${POSTGRES_VERSION-11}-alpine
environment: environment:
- "POSTGRES_HOST_AUTH_METHOD=trust" - "POSTGRES_HOST_AUTH_METHOD=trust"
command: postgres ${POSTGRES_ARGS-} command: postgres ${POSTGRES_ARGS-}
@ -38,7 +38,7 @@ services:
env_file: env_file:
- .env.dev - .env.dev
- .env - .env
image: redis:5 image: redis:7-alpine
volumes: volumes:
- "./data/${COMPOSE_PROJECT_NAME-node1}/redis:/data" - "./data/${COMPOSE_PROJECT_NAME-node1}/redis:/data"
networks: networks:
@ -48,11 +48,12 @@ services:
env_file: env_file:
- .env.dev - .env.dev
- .env - .env
build: &backend build:
context: ./api context: ./api
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
install_dev_deps: 1 install_dev_deps: 1
image: funkwhale-api
entrypoint: compose/django/dev-entrypoint.sh entrypoint: compose/django/dev-entrypoint.sh
command: > command: >
bash -c "python manage.py collectstatic --no-input bash -c "python manage.py collectstatic --no-input
@ -91,7 +92,7 @@ services:
env_file: env_file:
- .env.dev - .env.dev
- .env - .env
build: *backend image: funkwhale-api
depends_on: depends_on:
- postgres - postgres
# - minio # - minio

View File

@ -1,4 +1,4 @@
FROM node:16 as builder FROM node:16-alpine as builder
WORKDIR /app WORKDIR /app
COPY package.json yarn.lock /app/ COPY package.json yarn.lock /app/
@ -7,6 +7,7 @@ COPY scripts /app/scripts
COPY public /app/public COPY public /app/public
COPY vite.config.js index.html embed.html /app/ COPY vite.config.js index.html embed.html /app/
RUN apk add --no-cache jq bash coreutils python3
RUN yarn install RUN yarn install
RUN yarn build:deployment RUN yarn build:deployment

View File

@ -1,7 +1,7 @@
FROM node:16-buster FROM node:16-alpine
# needed to compile translations # needed to compile translations
RUN apt-get update && apt-get install -y jq RUN apk add --no-cache jq bash coreutils python3
EXPOSE 8080 EXPOSE 8080
WORKDIR /app/ WORKDIR /app/