Skip to content

Commit

Permalink
Switch from alpine to ubuntu as a base for the docker image
Browse files Browse the repository at this point in the history
The PFC components depend on glibc.  I'm building the web service as a
static binary so we don't need to install musl libc.

More info on golang static builds:
golang/go#26492
  • Loading branch information
caboteria committed Aug 4, 2020
1 parent 2ad9445 commit 265a910
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions build/package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
FROM golang:alpine as builder

# build the web service
ENV GOOS=linux

WORKDIR /usr/src/egw-ws
COPY . ./
RUN go build -o /usr/local/bin/ ./cmd/egw-ws

# build the web service (static)
RUN go build -tags 'osusergo netgo' -o /usr/local/bin/ ./cmd/egw-ws

# download golang-migrate
RUN apk add curl
RUN curl -sL https://github.com/golang-migrate/migrate/releases/download/v4.11.0/migrate.linux-amd64.tar.gz | tar -C /usr/local/bin -xzf -


# start fresh
FROM alpine
FROM ubuntu:20.04

# install dependencies
RUN apt-get update \
&& apt-get install -y postgresql-client libelf-dev \
&& rm -rf /var/lib/apt/lists/*

# install executables
RUN apk add postgresql-client busybox-extras
# copy executables from the builder image
WORKDIR /usr/local/bin
COPY --from=builder /usr/local/bin/migrate.linux-amd64 ./migrate
COPY --from=builder /usr/local/bin/egw-ws ./
Expand Down

0 comments on commit 265a910

Please # to comment.