mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-18 16:02:26 +01:00
Add .gitlab-ci.yml
This commit is contained in:
parent
5d0b15f7f7
commit
d59d2c61ee
2 changed files with 68 additions and 0 deletions
55
.gitlab-ci.yml
Normal file
55
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
stages:
|
||||
- build
|
||||
- build docker
|
||||
- push docker
|
||||
|
||||
build:
|
||||
image: golang:1-alpine
|
||||
stage: build
|
||||
before_script:
|
||||
- apk add git build-base
|
||||
script:
|
||||
- go build -o mautrix-whatsapp
|
||||
artifacts:
|
||||
paths:
|
||||
- mautrix-whatsapp
|
||||
|
||||
build docker:
|
||||
image: docker:stable
|
||||
stage: build docker
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
||||
- docker build --pull --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . --file Dockerfile.ci
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
|
||||
push latest:
|
||||
image: docker:stable
|
||||
stage: push docker
|
||||
only:
|
||||
- master
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
|
||||
- docker push $CI_REGISTRY_IMAGE:latest
|
||||
dependencies: []
|
||||
|
||||
push tag:
|
||||
image: docker:stable
|
||||
stage: push docker
|
||||
except:
|
||||
- master
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
dependencies: []
|
13
Dockerfile.ci
Normal file
13
Dockerfile.ci
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM alpine:latest
|
||||
|
||||
ENV UID=1337 \
|
||||
GID=1337
|
||||
|
||||
RUN apk add --no-cache su-exec ca-certificates
|
||||
|
||||
COPY ./mautrix-whatsapp /usr/bin/mautrix-whatsapp
|
||||
COPY ./example-config.yaml /opt/mautrix-whatsapp/example-config.yaml
|
||||
COPY ./docker-run.sh /docker-run.sh
|
||||
VOLUME /data
|
||||
|
||||
CMD ["/docker-run.sh"]
|
Loading…
Reference in a new issue