-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
228a8cb
commit bc6bef0
Showing
2 changed files
with
60 additions
and
0 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,39 @@ | ||
# Start from the latest golang base image | ||
FROM golang-1.14:alpine AS builder | ||
|
||
# maintainer | ||
LABEL maintainer="Amirhossein Najafizade" | ||
|
||
# timezon set | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Installing Git for alpine | ||
RUN apk add --no-cache git | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
RUN go mod download | ||
|
||
# Build the Go app | ||
WORKDIR /app | ||
RUN GOOS=darwin GOARCH=amd64 go build -o /app-runner | ||
|
||
# Start the main app | ||
FROM alpine:latest | ||
|
||
# Go into app directory | ||
WORKDIR /app/ | ||
|
||
# Copy the runner file | ||
COPY --from=builder /app-runner . | ||
|
||
# Give access to runner file | ||
RUN chmox +x /app-runner | ||
|
||
# Entry point | ||
ENTRYPOINT ["./app-runner"] |
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,21 @@ | ||
version: '3.9' | ||
services: | ||
golang.build: | ||
container_name: golang-mustache | ||
build: | ||
context: build | ||
dockerfile: build/Dockerfile | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- '.:/var/www/html' | ||
networks: | ||
- mustache | ||
|
||
|
||
networks: | ||
mustache: | ||
driver: bridge | ||
|