Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Make Dockerfile independent from gh releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaglow committed Nov 30, 2018
1 parent fe0bb5f commit 6d73b26
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
FROM alpine:latest
FROM golang:alpine as build
LABEL maintainer="contact@ilyaglotov.com" \
repository="https://github.com/ilyaglow/cortex-tgbot"

ENV CORTEXBOT_VERSION "0.9.6"
COPY cmd/cortexbot/main.go /go/src/cortexbot/main.go

RUN apk --update --no-cache add ca-certificates \
git \
&& cd /go/src/cortexbot/ \
&& go get -t . \
&& CGO_ENABLED=0 go build -ldflags="-s -w" \
-a \
-installsuffix static \
-o /cortexbot

FROM alpine:latest
COPY --from=build /cortexbot /app/cortexbot

RUN apk --update --no-cache add ca-certificates \
&& mkdir app \
&& wget -O /app/cortexbot.tar.gz https://github.com/ilyaglow/cortex-tgbot/releases/download/v${CORTEXBOT_VERSION}/cortexbot_${CORTEXBOT_VERSION}_linux_amd64.tar.gz \
&& cd /app \
&& tar xzf cortexbot.tar.gz \
&& chmod +x /app/cortexbot \
&& adduser -D app \
&& adduser -h /app -D app \
&& mkdir -p /app/data \
&& chown -R app /app

USER app

VOLUME /app
VOLUME /app/data

WORKDIR /app/data

Expand Down

0 comments on commit 6d73b26

Please sign in to comment.