Dockerize
This commit is contained in:
parent
77b61f4c61
commit
ecbb19563a
3 changed files with 38 additions and 0 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.env
|
||||
db.sqlite3
|
||||
26
.gitlab-ci.yml
Normal file
26
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
image: docker:stable
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
variables:
|
||||
CONTAINER_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH
|
||||
|
||||
before_script:
|
||||
- docker info
|
||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||
|
||||
build_image:
|
||||
stage: build
|
||||
script: |
|
||||
COMMIT_DATE=`date +%Y%m%d%H%M`
|
||||
docker pull $CONTAINER_IMAGE:$CI_COMMIT_BRANCH || true
|
||||
docker build --cache-from $CONTAINER_IMAGE:$CI_COMMIT_BRANCH \
|
||||
--tag $CONTAINER_IMAGE:$CI_COMMIT_BRANCH-$COMMIT_DATE \
|
||||
--tag $CONTAINER_IMAGE:$CI_COMMIT_BRANCH \
|
||||
.
|
||||
docker push $CONTAINER_IMAGE:$CI_COMMIT_BRANCH-$COMMIT_DATE
|
||||
docker push $CONTAINER_IMAGE:$CI_COMMIT_BRANCH
|
||||
10
Dockerfile
Normal file
10
Dockerfile
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.12
|
||||
RUN pip install pipenv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY Pipfile* /app/
|
||||
RUN pipenv install --system --deploy
|
||||
COPY . /app/
|
||||
|
||||
ENTRYPOINT python main.py
|
||||
Loading…
Reference in a new issue