-
Notifications
You must be signed in to change notification settings - Fork 1
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
c2bc447
commit 449109e
Showing
14 changed files
with
124 additions
and
33 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,49 @@ | ||
language: generic | ||
|
||
os: linux | ||
|
||
addons: | ||
apt: | ||
update: true | ||
packages: | ||
- golang-go | ||
|
||
jobs: | ||
include: | ||
- name: "Docker and Integration Tests" | ||
os: linux | ||
dist: jammy | ||
services: | ||
- docker | ||
env: | ||
- TAG=`if [ $TRAVIS_BRANCH == "master" ]; then echo -n latest; else echo -n $TRAVIS_BRANCH; fi` | ||
- REST_TAG=$TAG | ||
before_install: | ||
- sudo systemctl stop docker.service && sudo systemctl stop docker.socket | ||
- sudo apt-get install ca-certificates curl | ||
- sudo install -m 0755 -d /etc/apt/keyrings | ||
- sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | ||
- sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
- | | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | ||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
- sudo apt-get update | ||
install: | ||
- sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
- git clone https://github.com/koinos/koinos-integration-tests.git | ||
- pushd koinos-integration-tests | ||
- go get ./... | ||
- popd | ||
before_script: | ||
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | ||
- docker build . -t $TRAVIS_REPO_SLUG:$TAG | ||
script: | ||
- pushd koinos-integration-tests | ||
- ./run.sh | ||
after_success: | ||
- | | ||
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then | ||
docker push $TRAVIS_REPO_SLUG:$TAG | ||
fi |
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,40 @@ | ||
# https://towardsserverless.com/articles/dockerize-nextjs-app | ||
|
||
FROM node:18-alpine AS build | ||
# Install dependencies only when needed | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
# Copy and install the dependencies for the project | ||
COPY package.json yarn.lock ./ | ||
RUN yarn install | ||
# Copy all other project files to working directory | ||
COPY . . | ||
# Run the next build process and generate the artifacts | ||
RUN yarn build | ||
|
||
# we are using multi stage build process to keep the image size as small as possible | ||
FROM node:18-alpine | ||
# update and install latest dependencies, add dumb-init package | ||
# add a non root user | ||
RUN apk update && apk upgrade && apk add dumb-init && adduser -D nextuser | ||
|
||
# set work dir as app | ||
WORKDIR /app | ||
# copy the public folder from the project as this is not included in the build process | ||
COPY --from=build --chown=nextuser:nextuser /app/public ./public | ||
# copy the standalone folder inside the .next folder generated from the build process | ||
COPY --from=build --chown=nextuser:nextuser /app/.next/standalone ./ | ||
# copy the static folder inside the .next folder generated from the build process | ||
COPY --from=build --chown=nextuser:nextuser /app/.next/static ./.next/static | ||
# set non root user | ||
USER nextuser | ||
|
||
# expose 3000 on container | ||
EXPOSE 3000 | ||
|
||
# set app host ,port and node env | ||
ENV HOST=0.0.0.0 PORT=3000 NODE_ENV=production | ||
# start the app with dumb init to spawn the Node.js runtime process | ||
# with signal support | ||
CMD ["dumb-init","node","server.js"] |
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
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
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {} | ||
const nextConfig = { | ||
output: 'standalone' | ||
} | ||
|
||
module.exports = nextConfig |
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