-
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.
Merge pull request #6 from StartUpNationLabs/develop
deploy prod
- Loading branch information
Showing
44 changed files
with
4,686 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,32 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
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,5 @@ | ||
# Your account credential https://www.space-track.org | ||
SPACETRACK_USERNAME=xxx | ||
SPACETRACK_PASSWORD=xxx | ||
CELESTRACK_URL=http://localhost:9081/NORAD/elements | ||
SPACETRACK_URL=http://localhost:9080 |
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,58 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'develop' | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
docker: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: downcase REPO name as output | ||
id: downcase | ||
run: | | ||
echo "::set-output name=downcase::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" | ||
- name: Build and push api image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ghcr.io/${{ steps.downcase.outputs.downcase }}/api:${{ github.sha }}, ghcr.io/${{ steps.downcase.outputs.downcase }}/api:${{ github.ref_name }} | ||
|
||
- name: Build and push cache | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
context: ./nginx-cache | ||
tags: ghcr.io/${{ steps.downcase.outputs.downcase }}/nginx-cache:${{ github.sha }}, ghcr.io/${{ steps.downcase.outputs.downcase }}/nginx-cache:${{ github.ref_name }} | ||
|
||
# sed the image tag in manifests/dev/kustomization.yaml if the branch is develop else in manifests/prod/kustomization.yaml if the branch is main | ||
- name: Image digest | ||
run: | | ||
sed -i "s/newTag: .*/newTag: ${{ github.sha }}/g" manifests/overlays/${{ github.ref_name }}/kustomization.yaml | ||
cat manifests/overlays/${{ github.ref_name }}/kustomization.yaml | ||
- name: Commit and push changes | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
git add manifests/overlays/${{ github.ref_name }}/kustomization.yaml | ||
git commit -m "Update image tag to ${{ github.sha }}" | ||
git push |
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 |
---|---|---|
|
@@ -19,3 +19,6 @@ | |
|
||
# Go workspace file | ||
go.work | ||
|
||
.env | ||
.env.docker |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,65 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/engine/reference/builder/ | ||
|
||
################################################################################ | ||
# Create a stage for building the application. | ||
ARG GO_VERSION=1.22.2 | ||
FROM golang:${GO_VERSION} AS build | ||
WORKDIR /src | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds. | ||
# Leverage bind mounts to go.sum and go.mod to avoid having to copy them into | ||
# the container. | ||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=bind,source=go.sum,target=go.sum \ | ||
--mount=type=bind,source=go.mod,target=go.mod \ | ||
go mod download -x | ||
|
||
# Build the application. | ||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds. | ||
# Leverage a bind mount to the current directory to avoid having to copy the | ||
# source code into the container. | ||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=bind,target=. \ | ||
CGO_ENABLED=0 go build -o /bin/server ./cmd | ||
|
||
FROM alpine:latest AS final | ||
|
||
RUN apk --update add \ | ||
ca-certificates \ | ||
tzdata \ | ||
&& \ | ||
update-ca-certificates | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
|
||
|
||
RUN mkdir -p /data | ||
RUN chown -R appuser:appuser /data | ||
|
||
|
||
USER appuser | ||
|
||
# Copy the executable from the "build" stage. | ||
COPY --from=build /bin/server /bin/ | ||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 5566 | ||
EXPOSE 8080 | ||
|
||
# What the container should run when it is started. | ||
ENTRYPOINT [ "/bin/server" ] |
Oops, something went wrong.