Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG VARIANT=1-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

RUN apt-get update && apt-get install redis build-essential libpng-dev -y

ENTRYPOINT ["sleep", "infinity"]
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "Go",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"updateContentCommand": "go mod download && go generate -tags tools -x ./...",
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg"
],
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"go.goroot": "/usr/local/go",
"sqltools.connections": [
{
"name": "Container database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"database": "postgres",
"username": "postgres",
"password": "REPLACE_ME"
}
]
},
"forwardPorts": [
5432,
9000,
9001
],
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
41 changes: 41 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3'

services:
app:
build:
context: .
dockerfile: Dockerfile
args:
VARIANT: "1-bullseye"
NODE_VERSION: "none"
volumes:
- ..:/workspace:cached
cap_add:
- SYS_PTRACE
network_mode: service:postgres

redis:
image: redis:alpine
network_mode: service:postgres

postgres:
image: postgres:alpine
command: postgres -N 500 -B 4096MB
environment:
POSTGRES_PASSWORD: REPLACE_ME
ports:
- 5432:5432
- 6379:6379
- 9000:9000
- 9001:9001

minio:
image: minio/minio
network_mode: service:postgres
entrypoint: sh
command: -c 'mkdir -p /data/smr && /usr/bin/docker-entrypoint.sh minio server /data --console-address ":9001"'
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
MINIO_ACCESS_KEY: REPLACE_ME_KEY
MINIO_SECRET_KEY: REPLACE_ME_SECRET
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch smr-api",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/api",
"cwd": "${workspaceFolder}"
}
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ WORKDIR /app
COPY static /app/static
COPY migrations /app/migrations
EXPOSE 5020
ENTRYPOINT ["/api"]
ENTRYPOINT ["/api"]