-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from DedSecInside/add_docker
Add docker
- Loading branch information
Showing
4 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Dockerfile.production | ||
|
||
FROM registry.semaphoreci.com/golang:1.19 as builder | ||
|
||
ENV APP_HOME /go/src/gotor | ||
|
||
WORKDIR "$APP_HOME" | ||
|
||
# move over source code directories | ||
COPY api/ api/ | ||
COPY cmd/ cmd/ | ||
COPY internal/ internal/ | ||
COPY pkg/ pkg/ | ||
|
||
# move over necessary files, dependencies and configuration | ||
COPY go.mod . | ||
COPY go.sum . | ||
COPY .env . | ||
|
||
RUN go mod download | ||
RUN go mod verify | ||
RUN go build -o gotor cmd/main/main.go | ||
|
||
FROM registry.semaphoreci.com/golang:1.19 | ||
|
||
ENV APP_HOME /go/src/gotor | ||
RUN mkdir -p "$APP_HOME" | ||
WORKDIR "$APP_HOME" | ||
|
||
COPY api/ . | ||
COPY pkg/ . | ||
COPY internal/ . | ||
COPY cmd/ cmd/ | ||
COPY .env . | ||
COPY --from=builder "$APP_HOME"/gotor $APP_HOME | ||
|
||
EXPOSE 8081 | ||
CMD ["./gotor", "-server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters