much smaller docker images

This commit is contained in:
Artem Titoulenko 2021-12-24 15:48:36 -05:00
parent b016645ea7
commit f8f5378662
2 changed files with 9 additions and 9 deletions

View file

@ -2,15 +2,14 @@ FROM golang:1.17-alpine3.14 AS build
WORKDIR /app
COPY go.mod go.sum /app
RUN go mod download && go mod vendor
RUN ls -l /app
RUN go mod download
COPY . /app
RUN ls -l /app
RUN go build -ldflags="-s -w" -o aim
RUN chmod +x aim
RUN go build -ldflags="-s -w" -o /app/aim
RUN chmod +x /app/aim
FROM scratch AS prod
FROM golang:1.17-alpine3.14 AS prod
WORKDIR /app
EXPOSE 5190
ARG OSCAR_HOST
@ -18,5 +17,6 @@ ARG OSCAR_PORT
ARG OSCAR_BOS_HOST
ARG OSCAR_BOS_PORT
COPY --from=build /app/models /app/models
COPY --from=build /app/aim /app/aim
ENTRYPOINT /app/aim
CMD ["/app/aim"]

View file

@ -89,7 +89,7 @@ func main() {
// dev: load in fixtures to test against
fixture := dbfixture.New(db, dbfixture.WithRecreateTables())
err = fixture.Load(context.Background(), os.DirFS("models"), "fixtures.yml")
err = fixture.Load(context.Background(), os.DirFS("./models"), "fixtures.yml")
if err != nil {
panic(err)
}