Skip to content

Commit

Permalink
update dockerfile for releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoegel committed Sep 15, 2024
1 parent 09afb2c commit c634866
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*.dll
*.so
*.dylib
rsvp.pizza
*.env
credentials.json
token.json
Expand Down
15 changes: 5 additions & 10 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}_
Expand Down Expand Up @@ -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
30 changes: 5 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c634866

Please sign in to comment.