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
Showing
3 changed files
with
43 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,3 @@ | ||
.git/ | ||
fme | ||
|
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,28 @@ | ||
FROM golang:1.21 as builder | ||
|
||
WORKDIR /app | ||
|
||
# Copy the go.mod files first to leverage Docker cache | ||
COPY go.mod ./ | ||
|
||
# Download the Go modules (including the one hosted on GitHub). | ||
RUN go mod download | ||
|
||
# Copy the rest of the application's source code. | ||
COPY . . | ||
|
||
# Build the application. | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o fme . | ||
|
||
# Use a Docker multi-stage build to create a lean production image. | ||
FROM alpine:latest | ||
|
||
|
||
# Set the working directory to /root/ | ||
WORKDIR /root/ | ||
|
||
# Copy the pre-built binary file from the previous stage. | ||
COPY --from=builder /app/fme . | ||
|
||
# Run the application. | ||
CMD ["./fme"] |
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 |
---|---|---|
@@ -1,3 +1,15 @@ | ||
# fme - future me | ||
|
||
This is a simple commandline utility that asks and saves to a text file a list of your goals. | ||
|
||
# Docker image | ||
|
||
To build Docker image, run in the project directory: | ||
`docker build -t fme:v1.0.0 .` | ||
|
||
To create a new container named my-fme-app: | ||
|
||
`docker run --name my-fme-app -it fme:v1.0.0` | ||
|
||
To run `my-fme-app` again, start the container in interactive mode: | ||
`docker container start -i my-fme-app` |