Previously we built a Docker image just for the test,
but the introduction of multi-arch build in 9fbf0952
build also meant the push of the image, so it was
restricted only to the master branch.
This change re-introduces the Docker image build
outside the master branch, which is helpful
in pull requests.
We recently had a few frontend PRs which broke
the Docker image build silently, and that change
prevents it from happening.
19 lines
494 B
Docker
19 lines
494 B
Docker
FROM umputun/baseimage:buildgo-v1.9.2 as build-backend
|
|
|
|
ADD backend /build/backend
|
|
WORKDIR /build/backend/_example/memory_store
|
|
|
|
RUN go build -o /build/bin/memory_store -ldflags "-X main.revision=0.0.0 -s -w"
|
|
|
|
FROM umputun/baseimage:app-v1.9.2
|
|
|
|
WORKDIR /srv
|
|
COPY --from=build-backend /build/bin/memory_store /srv/memory_store
|
|
RUN chown -R app:app /srv
|
|
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=30s --timeout=3s CMD curl --fail http://localhost:8080/ping || exit 1
|
|
USER app
|
|
|
|
CMD ["/srv/memory_store"]
|