-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (30 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
30 lines (30 loc) · 1.28 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
# Lightweight alpine OS, weight only 5mb, everything else is Go environment
FROM golang AS builder
ARG HOST=${HOST}
ARG PORT=${PORT}
ARG DATABASE_URL=${DATABASE_URL}
ARG GITHUBSTATBOT_GITHUBCLIENTID=${GITHUBSTATBOT_GITHUBCLIENTID}
ARG GITHUBSTATBOT_GITHUBCLIENTSECRET=${GITHUBSTATBOT_GITHUBCLIENTSECRET}
ARG GITHUBSTATBOT_MODE=${GITHUBSTATBOT_MODE}
ARG GITHUBSTATBOT_TELEGRAMTOKEN=${GITHUBSTATBOT_TELEGRAMTOKEN}
ARG TZ=${TZ}
# Workdir is path in your docker image from where all your commands will be executed
WORKDIR /go/src/github.com/proshik/githubstatbot
# Add all from your project inside workdir of docker image
ADD . /go/src/github.com/proshik/githubstatbot
# Then run your script to install dependencies and build application
RUN CGO_ENABLED=0 go build -v
# Next start another building context
FROM alpine:3.6
# add certificates
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
# Change work directory
WORKDIR /app
# Copy static
COPY --from=builder /go/src/github.com/proshik/githubstatbot/static ./static
# Copy only build result from previous step to new lightweight image
COPY --from=builder /go/src/github.com/proshik/githubstatbot/githubstatbot .
# Expose port for access to your app outside of container
EXPOSE 80
# Starting bundled binary file
ENTRYPOINT [ "./githubstatbot" ]