Skip to content

Commit

Permalink
docker stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Schuler committed Jan 21, 2025
1 parent 8e4480e commit 226a4a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
10 changes: 10 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
gb-api:
image: ghcr.io/jake-schuler/guestbook-api:latest
container_name: gb-api
ports:
- "1323:1323"
volumes:
- ./assets:/app/assets
- ${PWD}/gb-api.db:/app/gb-api.db
restart: always
21 changes: 12 additions & 9 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM golang:alpine as build
WORKDIR /app
COPY . /app
RUN go build -o gb-api .
FROM alpine
WORKDIR /app
COPY --from=build /app/gb-api .
EXPOSE 1323
CMD ["gb-api"]
FROM golang:1.23

WORKDIR /usr/src/app

# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .
RUN go build -v -o /usr/local/bin/app ./...

CMD ["app"]

0 comments on commit 226a4a4

Please sign in to comment.