Skip to content

Make docker container to be buildable from local state #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions docker/linux/2.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
# docker run -d -p 8080:80 -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_S3_BUCKET pottava/s3-proxy

FROM golang:1.13.7-alpine3.11 AS builder

ARG APP_VERSION=v2.0.0

WORKDIR /build

RUN apk --no-cache add gcc musl-dev git
RUN go get -u github.com/pottava/aws-s3-proxy
WORKDIR /go/src/github.com/pottava/aws-s3-proxy
ENV APP_VERSION=v2.0.0
RUN git checkout "${APP_VERSION}" > /dev/null 2>&1
RUN go mod download
RUN go mod verify

COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .

RUN githash=$(git rev-parse --short HEAD 2>/dev/null) \
&& today=$(date +%Y-%m-%d --utc) \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags '-s -w -X main.ver=${APP_VERSION} -X main.commit=${githash} -X main.date=${today}' \
-ldflags "-s -w -X main.ver=${APP_VERSION} -X main.commit=${githash} -X main.date=${today}" \
-o /app

FROM alpine:3.11 AS libs
Expand Down