-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathDockerfile.test
More file actions
36 lines (28 loc) · 1.15 KB
/
Dockerfile.test
File metadata and controls
36 lines (28 loc) · 1.15 KB
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
FROM golang:alpine
ENV PYTHONUNBUFFERED=1
# Install required packages
RUN apk update && apk add --no-cache \
git \
curl \
python3 \
py3-boto3 \
build-base \
bash \
ca-certificates \
&& if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi
# Alternative approach if py3-boto3 is not available:
# RUN python3 -m venv /opt/venv && \
# . /opt/venv/bin/activate && \
# pip install boto3 && \
# ln -s /opt/venv/bin/boto3 /usr/local/bin/boto3
# Set up environment
ENV DIR=/go/src/github.com/MG-RAST/Shock
WORKDIR ${DIR}
# Create necessary directories
RUN mkdir -p /var/log/shock /usr/local/shock/data /etc/shock.d /test-output && \
chmod 777 /test-output
# Copy source code (uses vendored dependencies via -mod=vendor)
COPY . ${DIR}
# Create test configuration
RUN echo '{"address":"0.0.0.0:7445","auth":{"basic":true},"mongodb":{"hosts":["shock-mongo-test"],"database":"shock_test"},"paths":{"data":"/var/log/shock/data","logs":"/var/log/shock","site":"/usr/local/shock/site"},"ssl":{"enable":false},"admin_users":["test_admin"]}' > /etc/shock.d/shock-server.conf
CMD ["go", "test", "-mod=vendor", "-v", "./..."]