-
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.
feat(golang): add new container for go v1.20.11
- Loading branch information
Showing
5 changed files
with
87 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |
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,19 @@ | ||
FROM docker.io/library/golang:1.20.11-alpine3.18 | ||
|
||
ARG BUILD_REV | ||
ARG BUILD_DATE | ||
LABEL org.opencontainers.image.title="alwatr/golang" \ | ||
org.opencontainers.image.description="Go (golang) is a general purpose, higher-level, imperative programming language, packaged by Alwatr." \ | ||
org.opencontainers.image.base.name="docker.io/library/golang:1.20.11-alpine3.18" \ | ||
org.opencontainers.image.version="1.20.11" \ | ||
org.opencontainers.image.ref.name="1.20.11" \ | ||
org.opencontainers.image.licenses="MIT" \ | ||
org.opencontainers.image.created=${BUILD_DATE} \ | ||
org.opencontainers.image.revision=${BUILD_REV} \ | ||
org.opencontainers.image.vendor="Alwatr" \ | ||
org.opencontainers.image.source="https://github.com/Alwatr/containers/tree/next/golang" \ | ||
org.opencontainers.image.url="https://github.com/Alwatr/containers/tree/next/golang" \ | ||
org.opencontainers.image.documentation="https://github.com/Alwatr/containers/tree/next/golang" \ | ||
org.opencontainers.image.authors="S. Ali Mihandoost <[email protected]> (https://ali.mihandoost.com), S. Amir Mohammad Najafi <[email protected]> (https://njfamirm.ir/)" \ | ||
cloud.alwatr.image.version.full="1.20.11" \ | ||
cloud.alwatr.image.version.short="1" |
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,51 @@ | ||
# Alwatr Golang Container | ||
|
||
Go (golang) is a general purpose, higher-level, imperative programming language, packaged by Alwatr. | ||
|
||
## Usage | ||
|
||
Check versions from [Alwatr/packages](https://github.com/Alwatr/containers/pkgs/container/golang) | ||
|
||
### Install from the command line | ||
|
||
```bash | ||
docker pull ghcr.io/alwatr/golang:1.21.4 | ||
``` | ||
|
||
### Use as base image in Dockerfile | ||
|
||
```dockerfile | ||
FROM ghcr.io/alwatr/golang:1.21.4 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Pre-copy/cache go.mod to pre-download dependencies and only re-download 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/my-app ./ | ||
|
||
CMD ["my-app"] | ||
``` | ||
|
||
### Use as a builder image in a multi-stage Dockerfile | ||
|
||
```dockerfile | ||
FROM ghcr.io/alwatr/golang:1.21.4 AS builder | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Pre-copy/cache go.mod to pre-download dependencies and only re-download 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/my-app ./ | ||
|
||
FROM ghcr.io/alwatr/alpine:3.18 | ||
|
||
COPY --from=builder /usr/local/bin/my-app /usr/local/bin/my-app | ||
|
||
CMD ["my-app"] | ||
``` |