mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-22 15:53:36 +00:00
Add dockerfile for testing
This commit is contained in:
@@ -1 +1,21 @@
|
|||||||
mongox-go-driver
|
# mongox-go-driver
|
||||||
|
|
||||||
|
## testing locally
|
||||||
|
|
||||||
|
reqs:
|
||||||
|
- mongodb v4.0 or newer run on localhost
|
||||||
|
- golang v1.13 or newer
|
||||||
|
|
||||||
|
test it by calling go tests
|
||||||
|
```sh
|
||||||
|
$ go test ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
## testing by using dockerfile
|
||||||
|
|
||||||
|
reqs:
|
||||||
|
- docker with buildkit
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ DOCKER_BUILDKIT=1 docker build -t mongox-testing -f testing.Dockerfile .
|
||||||
|
```
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# syntax = docker/dockerfile:1.3-labs
|
||||||
|
FROM registry.access.redhat.com/ubi8/ubi
|
||||||
|
|
||||||
|
RUN <<EOF cat >> /etc/yum.repos.d/mongo.repo
|
||||||
|
[mongodb-org]
|
||||||
|
name=MongoDB Repository
|
||||||
|
baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.4/x86_64/
|
||||||
|
gpgcheck=1
|
||||||
|
enabled=1
|
||||||
|
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
|
||||||
|
EOF
|
||||||
|
|
||||||
|
RUN set -eux \
|
||||||
|
&& dnf makecache \
|
||||||
|
&& dnf install -yq mongodb-org-server golang \
|
||||||
|
&& dnf clean all
|
||||||
|
|
||||||
|
WORKDIR /root/mongox
|
||||||
|
|
||||||
|
ENV GOPATH=/root/go
|
||||||
|
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
|
||||||
|
RUN set -eux \
|
||||||
|
&& go mod download
|
||||||
|
|
||||||
|
COPY mongox-testing mongox-testing
|
||||||
|
COPY mongox mongox
|
||||||
|
|
||||||
|
CMD set -eux \
|
||||||
|
&& nohup mongod --dbpath $(mktemp -d) \
|
||||||
|
& go test -timeout 30s -v ./...
|
||||||
Reference in New Issue
Block a user