forked from sauravsrijan/py38-test
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
58 lines (39 loc) · 1.38 KB
/
Dockerfile
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
53
54
55
56
57
58
#
# Phase: Build
#
ARG MARVIN_VERSION
ARG REGISTRY_NAME
FROM golang:1.12.9-alpine3.10 AS builder
# Necessary dependencies
RUN echo "https://mirror.csclub.uwaterloo.ca/alpine/v3.10/main" >/etc/apk/repositories
RUN echo "https://mirror.csclub.uwaterloo.ca/alpine/v3.10/community" >>/etc/apk/repositories
RUN apk update
RUN apk add bash curl git musl openssh openssh-client gcc build-base
### Application ###
RUN mkdir /app /code
# Copy the code
COPY . /code
WORKDIR /code
# Compile the binary
RUN GOOS=linux GOARCH=amd64 go build -tags static_all -o /app/marvin-dockerfile .
### Toolbox ###
RUN mkdir /toolbox
FROM us.gcr.io/$REGISTRY_NAME/marvin:$MARVIN_VERSION
USER root
# Necessary dependencies
RUN echo "https://mirror.csclub.uwaterloo.ca/alpine/v3.10/main" >/etc/apk/repositories
RUN echo "https://mirror.csclub.uwaterloo.ca/alpine/v3.10/community" >>/etc/apk/repositories
RUN apk update
RUN apk add bash curl git go build-base musl-dev openssh
# Secure code directory
RUN chmod -R 777 /etc
RUN chmod -R o-rwx /code
RUN useradd -u 1000 runner && mkdir -p /home/runner && chown -R 1000:3000 /home/runner
# Copy the builds
COPY --from=builder /app /app
#
# Phase: Analyzer
# Install hadolint
RUN wget -O /toolbox/hadolint https://github.com/hadolint/hadolint/releases/download/v1.17.2/hadolint-Linux-x86_64
RUN chmod u+x /toolbox/hadolint && chown -R 1000:3000 /toolbox/hadolint
USER 1000