forked from TRON-US/go-btfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.unit_testing
52 lines (38 loc) · 1.31 KB
/
Dockerfile.unit_testing
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM golang:1.13-stretch
MAINTAINER TRON-US <support@tron.network>
# Dockerfile.unit_testing will build an image to run the go unit tests.
# Use the regular Dockerfile to run a btfs daemon instead
ENV SRC_DIR /go-btfs
ENV TEST_NO_FUSE 1
#set timeout value for unit tests
ENV GOTFLAGS -timeout 3m
# Download packages first so they can be cached.
COPY go.mod go.sum $SRC_DIR/
RUN cd $SRC_DIR \
&& go mod download
COPY . $SRC_DIR
# Install patch
RUN apt-get update && apt-get install -y patch
# Install FUSE
RUN apt-get update && apt-get install -y fuse
# Do this in the current container
RUN mv /bin/fusermount /usr/local/bin/fusermount
# Add suid bit on fusermount so it will run properly
RUN chmod 4755 /usr/local/bin/fusermount
# Create the fs-repo directory and switch to a non-privileged user.
ENV BTFS_PATH /data/btfs
RUN mkdir -p $BTFS_PATH
# Create mount points for `btfs mount` command
RUN mkdir /btfs /btns
# Expose the fs-repo as a volume.
# start_btfs initializes an fs-repo if none is mounted.
# Important this happens after the USER directive so permission are correct.
VOLUME $BTFS_PATH
# The default logging level
ENV BTFS_LOGGING ""
ENV PATH="/usr/local/go/bin:${PATH}"
WORKDIR /go-btfs
RUN git init
RUN git add .
# by default lets run the go fmt, tidy and unit tests
CMD make test_go_fmt test_go_mod test_go_test