Skip to content
Snippets Groups Projects
Commit 1fb5053f authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

add Dockerfile & CI

parent 5df81d16
No related branches found
No related tags found
No related merge requests found
Pipeline #12428 failed
stages:
- build
- test_deploy
image: docker:20.10.8
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_TAG_APP: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
services:
- docker:20.10.8-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build_app:
stage: build
script:
- docker pull $CI_REGISTRY_IMAGE:test || true
- docker build --cache-from $CI_REGISTRY_IMAGE:test -t $IMAGE_TAG_APP .
- docker push $IMAGE_TAG_APP
deploy:
stage: test_deploy
when: manual
before_script:
- apk add --update curl && rm -rf /var/cache/apk/*
script:
- curl -k -X POST $DEPLOY_HOOK
FROM python:3.11
RUN mkdir /app
WORKDIR /app
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install nodejs && rm -rf /var/lib/apt/lists/*
COPY . .
RUN pip install -r requirements/base.txt -r requirements/production.txt
RUN npm install
RUN npm run build
# Placeholder values so the static files collect
RUN DATABASE_URL=postgres://x/x \
SECRET_KEY=x \
ALLOWED_HOSTS=x \
SITE_URL=x \
OIDC_RP_REALM_URL=x \
OIDC_RP_CLIENT_ID=x \
OIDC_RP_CLIENT_SECRET=x \
python manage.py collectstatic --noinput --settings=ucebnice.settings.production
RUN bash -c "adduser --disabled-login --quiet --gecos app app && \
chmod -R o+r /app/ && \
chmod o+x /app/run.sh"
USER app
ENV DJANGO_SETTINGS_MODULE "ucebnice.settings.production"
EXPOSE 8000
CMD ["bash", "run.sh"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment