Skip to content

Commit

Permalink
update dockerfile (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode committed Jun 25, 2023
1 parent 516f500 commit c3eeaf7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
FROM cesslab/cess-pbc-env:latest AS builder
FROM golang:alpine AS builder

# go_proxy
ARG go_proxy
ENV GOPROXY ${go_proxy}

# Download packages first so they can be cached.
COPY go.mod go.sum /opt/target/
RUN cd /opt/target/ && go mod download
# Workdir
WORKDIR /opt/target

# Copy file
COPY . /opt/target/

# Build the thing.
# Build
RUN cd /opt/target/ \
&& go build -ldflags '-w -s' -gcflags '-N -l' -o cess-bucket cmd/main/main.go
&& go mod download \
&& GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -gcflags '-N -l' -o cess-bucket cmd/main.go

FROM cesslab/cess-pbc-env:latest
# Run
FROM alpine AS runner
WORKDIR /opt/cess
COPY --from=builder /opt/target/cess-bucket ./

0 comments on commit c3eeaf7

Please sign in to comment.