From c634866e963a81bed294ede2495a01265a8ffbbc Mon Sep 17 00:00:00 2001 From: Matt Poegel Date: Sun, 15 Sep 2024 19:39:49 +0000 Subject: [PATCH] update dockerfile for releasing --- .dockerignore | 1 - .goreleaser.yaml | 15 +++++---------- Dockerfile | 30 +++++------------------------- 3 files changed, 10 insertions(+), 36 deletions(-) diff --git a/.dockerignore b/.dockerignore index fe88415..b141a1c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,7 +4,6 @@ *.dll *.so *.dylib -rsvp.pizza *.env credentials.json token.json diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c16539a..4c0e7f5 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,6 +1,11 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json + +version: 2 + before: hooks: - go mod tidy + builds: - main: main.go id: rsvp_pizza @@ -23,7 +28,6 @@ builds: archives: - format: tar.gz - rlcp: true # this name template makes the OS and Arch compatible with the results of uname. name_template: >- {{ .ProjectName }}_ @@ -62,18 +66,9 @@ archives: group: root mode: 0644 -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ incpatch .Version }}-next" changelog: sort: asc filters: exclude: - '^docs:' - '^test:' - -# The lines beneath this are called `modelines`. See `:help modeline` -# Feel free to remove those if you don't want/use them. -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/Dockerfile b/Dockerfile index 05a799b..edc7957 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,5 @@ -FROM golang - -WORKDIR /usr/src/pizza - -COPY go.mod go.sum ./ -RUN go mod download && go mod verify - -COPY static /etc/pizza/static - -COPY . . -RUN go build -o /usr/local/bin/rsvp.pizza - -ENV PIZZA_STATIC_DIR=/etc/pizza/static -ENV CREDENTIAL_FILE=/etc/pizza/creds/credentials.json -ENV TOKEN_FILE=/etc/pizza/creds/token.json -ENV DBFILE=/etc/pizza/db/pizza.db -ENV PORT=9090 -ENV METRICS_PORT=9191 - -EXPOSE 9090 -EXPOSE 9191 - -VOLUME [ "/etc/pizza/db/", "/etc/pizza/creds/" ] - -CMD ["/usr/local/bin/rsvp.pizza", "run"] +FROM scratch +COPY rsvp.pizza / +ENTRYPOINT [ "/rsvp.pizza" ] +COPY static /etc/rsvp.pizza/static +ENV STATIC_DIR=/etc/rsvp.pizza/static